Quantcast
Channel: Aspose.Pdf Product Family
Viewing all 1038 articles
Browse latest View live

Out of memory exception

$
0
0
Hello, I am trying to create large document with around 200-300 pages having 20-40 bit map images(From steema tee chart). It gives out of memory exception while creating document and sometimes while saving the document. Could you please tell me does Aspose have any memory leak issues, and if yes how to resolve them, this is urgent and could you please provide me some solutions , at this moment I am not able to provide you any code. I am using VS2015, windows 7 os with 8 GB ram and 64 bit os,

Page numbers are not showing in footer - PDF

$
0
0
Hi,

Issue here is:
When I convert document from HTML to PDF (using download option), page numbers are not showing.

I don't create page numbers in footer, just converting from HTML to PDF.

Html for footer is:
<div style="-aw-headerfooter-type:footer-primary"> 
 <div style="-aw-sdt-tag:''"> 
  <p style="margin-top:0pt; margin-bottom:0pt; text-align:right; font-size:11pt"><span style="-aw-field-start:true"></span><span style="-aw-field-code:' PAGE   \\* MERGEFORMAT '"></span><span style="-aw-field-separator:true"></span><span style="font-family:Calibri">1</span><span style="-aw-field-end:true"></span></p> 
 </div> 
 <p style="margin-top:0pt; margin-bottom:0pt; font-size:11pt"><span style="font-family:Calibri">&nbsp;</span></p> 
</div>

Code for converting HTML to PDF:
input = new ByteArrayInputStream(documentDomain.getHtmlContent().getBytes("UTF-8"));
com.aspose.pdf.Document doc = new com.aspose.pdf.Document(input);
out = new ByteArrayOutputStream();
doc.save(out, com.aspose.words.SaveFormat.PDF);

If I create page numbers everything works fine, but I don't want to create page numbers in footer if it already exists.

Do you know what is a problem here?

This is working for Word but for PDF not.
I attached both Word and PDF.

Regards

ASPOSE.PDF HtmlFragment Size Limit Issue

$
0
0

Hi,

We are getting SystemOutOfMemory exception when we are trying to create PDF from Html content, and the content size exceeds more than(250-300 kb). We are using Aspose PDF HtmlFragment for rendering html content in PDF.

Also here we are  attaching the sample code to understand our scenario better.

Please  suggest/provide  any alternative or work around for this issue.

Thanks

Missing Assembly error (Aspose.Font and Aspose.HTML) and table formatting error

$
0
0
Hello,



as in Thread https://www.aspose.com/community/forums/thread/835575.aspx mentioned does Aspose.Pdf 17.1 and newer throw the Assemly Aspose.Font missing error.



We updated all the dll's to the newest version (see below), but due to the problem mentioned above, we have to use an older version of Aspose.Pdf.

Unfortunytely, from version 16.10 on, a FileNotFoundException is thrown, because the Aspose.HTML assemly is missing, when we load an HTML document into an Aspose.Pdf document, including an HTMLLoadOption to define a CustomLoaderOfExternalResources:



Aspose.Pdf.HtmlLoadOptions htmlOptions = new Aspose.Pdf.HtmlLoadOptions(folderUrl);

htmlOptions.CustomLoaderOfExternalResources = uri => { //handling of referenced files };

Aspose.Pdf.Document htmlDocument = new Aspose.Pdf.Document(memoryStream, htmlOptions) { IgnoreCorruptedObjects = true };




I tested ALL versions starting from 11.2.0 to 16.12.0 regarding both missing assembly errors - the result:
we have to use the Aspose.Pdf 12.0.0 version, but this version does not render tables correctly (see attachment - the blackening in the screenshot is due to data protection).




So, right now, our only possibility to convert an HTML file into PDF is to use Aspose.PDF version 12.0.0, including the table rendering issue...that is really, really frustrating!





.Net 3.5, SharePoint 2010, Windows Server 2008 R2

Aspose.Pdf 12.0.0.0

Aspose.Cells 17.5.0.0

Aspose.Email 17.4.0.0

Aspose.Imaging 17.4.0.0

Aspose.Slides 17.4.0.0

Aspose.Words 17.5.0.0

HTML table border style shows in bold.

$
0
0
Hi Support,

When we generated a pdf from Word template. The below content generated html table as expected. But displaying the border in bold. Please find attached screenshot for the same.
























Level LoA Triggers Approval Request Justification/Mitigations
46.4 Limit of Liabilitytest
36.5 Indirect and Consequential Damages4test


Could you please help us to resolve this issue. We will definitely appreciate your help.

Thanks & Regards,
Faisal. N

Extract table from pdf

$
0
0
Hi team,
I'm trying to extract table from pdf file but it is not working with TableAbsorber .Tables are identified but data is not coming.Please Tell me something

How to add Tooltip to a cell using ASPOSE API

$
0
0
Hi,

I have an FTL template file which we use to generate a PDF. i am trying to add a tooltip text to this template file using ASPOSE API. 

Can someone please help how this can be done?

Here is a sample of my file - 

<Table ColumnWidth="100%"><row><cell><segment> Hi How are you..!  </segment></cell></row></Table>

Is it possible to have TextAnnotation in XML

$
0
0
Hi,
is it possible to use a TextAnnotation in XML format like how we would use Segment or Attachment?

Thank you
pranusha

HtmlLoadOptions for HtmlFragment

$
0
0
I have snippets of HTML that I want to add to my pdf. The html Snippets have images embeded as base64 string in the html itself.
When I add the html snippet as HTMLfragement to  page it works fine, but when the images are big it cuts of the image.. Following is the code I am doing
row = table.getRows().add();
c = row.getCells().add();
HtmlFragment html = new HtmlFragment(i.getComments());
c.getParagraphs().add(html);But when I do the same html snippet with loadoptions and save as
pdf it looks fine.
Document htmlDoc = new Document(new ByteArrayInputStream(i.getComments().getBytes(StandardCharsets.UTF_8)),
htmlLoadOptions);
htmlDoc.save(
"D:/work/temp_xxx.pdf");Is there a way for me when creating a HTMLFragment, to set the size like loadOptions ? If not is their a workaround ?

Not all PDF Form Fields Being Returned

$
0
0
I am trying to use Aspose.Pdf to enumerate the form fields in a PDF.

I am using Aspose.Pdf version 2016.08.02 (11.9.0.0). I start by opening the PDF:

Dim document As New Aspose.Pdf.Document(Server.MapPath("~/App_Data/88.pdf"))


I then enumerate the fields in document.Form. For each field, I call a method that displays the information:

For Each fld As Aspose.Pdf.Forms.Field In document.Form
    DisplayField(fld)
Next


In the DisplayField method I see if it's a group and, if so, recurse into the children of the group. Otherwise I just display the form field details (this is an ASP.NET application).

Private Sub DisplayField(fld As Aspose.Pdf.Forms.Field)
    If fld.IsGroup Then
        For Each childFld As Aspose.Pdf.Forms.Field In fld
            DisplayField(childFld)
        Next
    Else
        lblOutput.Text &= String.Format("<p>Name={0}, PartialName={1}, FullName={2}, Required={3}, ReadOnly={4}, Value={5}</p>",
                                        fld.Name,
                                        fld.PartialName,
                                        fld.FullName,
                                        fld.Required,
                                        fld.ReadOnly,
                                        fld.Value)
    End If
End Sub


The issue, though, is that it only enumerates through a small number of the form fields in the PDF. There are many other (on the same page and other pages) that aren't getting displayed. For instance, the attached PDF has 32 form fields. But when I use the above code, Aspose.Pdf returns only 4 form fields.

Here's the output displayed in the web page. You can see I only get 4 form fields:

Name=, PartialName=box1 pg1, FullName=box1 pg1, Required=False, ReadOnly=False, Value=Yes

Name=, PartialName=box2 pg1, FullName=box2 pg1, Required=False, ReadOnly=False, Value=

Name=, PartialName=box3 pg1, FullName=box3 pg1, Required=False, ReadOnly=False, Value=

Name=, PartialName=fname1 pg1, FullName=fname1 pg1, Required=False, ReadOnly=False, Value=The Village Family Services


How do I get ALL form fields?

What's interesting, it that if I debug and view in the Immediate Window the following:

document.Form.Count

I get back 32 (as to be expected). 

But if I do:

document.Form.Fields.Count

I get back 4, which would explain why it only shows four form fields. When I step through the code I see that the loop is only iterated through 4 times. So what gives? How do I loop through all 32 form fields?

Convert HTML to PDF - change font, margin and size

$
0
0
I am converting an hml string to PDF. the issues are:

1) ignoring margins when printing 
2) ignoring font size
3) need to set to legal size paper

code

string pageSource="<html>
<head>
</head>
<body>
    REPORT NO. xxxxxxx                                                Company Name                                                                                    RUN DATE 02/01/17       PAGE    1<br />PROG. ID   xxxxxx                                                   XXXXX/XXXX XXX XXXXXXXXXXX XXXXXXX Statement                                                                         RUN TIME 03:59:11<br />                                                                    For Month Ending JAN 2017<br /><br />XXXXXXXXXXX Company BCAG XXXXXXXXXXX COMPANY, LTD.<br />XXXXXXXXXXX ID No.  I0001<br />XXXXXX No.  207139/XXXXX UNIVERSE<br /><br />                                                                XXXXX_XXXX CARE NEW XXX                    XXXXX_XXXX CARE USED XXX                         NON-XXXXX XXX                                Grand Total<br />                                                            Current  Calendar Year      Inception       Current  Calendar Year      Inception       Current  Calendar Year      Inception       Current  Calendar Year      Inception<br />                                                             Month       Todate           Todate         Month       Todate           Todate         Month       Todate           Todate         Month       Todate           Todate<br /><br />A. PREMIUM<br />  1. XXXX XXXXXXX                                        10,403.25      10,403.25      10,403.25      3,546.00       3,546.00       3,546.00           .00            .00            .00     13,949.25      13,949.25      13,949.25<br />  2. XXXXXXXX XXXX - CANC XXX                                   .00            .00            .00           .00            .00            .00           .00            .00            .00           .00            .00            .00<br />  3. NET XXXXXXX PREMIUM                                  10,403.25      10,403.25      10,403.25      3,546.00       3,546.00       3,546.00           .00            .00            .00     13,949.25      13,949.25      13,949.25<br /><br />B. XXXXXX XXXX                                               520.16         520.16         520.16        177.30         177.30         177.30           .00            .00            .00        697.46         697.46         697.46<br /><br />C. XXXX XXXXX                                                  .00            .00            .00           .00            .00            .00           .00            .00            .00           .00            .00            .00<br /><br />D. XXXXXXXXXX (A3-B-C)=D                                 9,883.09       9,883.09       9,883.09      3,368.70       3,368.70       3,368.70           .00            .00            .00     13,251.79      13,251.79      13,251.79<br /><br />E. XXXXXXXXXXXXXXXXXXXXX<br />  1. UNEARNED PREMIUM                                           .00            .00            .00           .00            .00            .00           .00            .00            .00           .00            .00            .00<br />  2. INCURRED BUT NOT REPORTED                                  .00            .00            .00           .00            .00            .00           .00            .00            .00           .00            .00            .00<br />  3. XXXXXXXXXXXXXXXXXXXXXX                        .00            .00            .00           .00            .00            .00           .00            .00            .00           .00            .00            .00<br /><br />F. XXXXXXXXXXXXXXXXXXXXXXXXXXXX<br />  1. UNEARNED PREMIUM                                     10,399.58      10,399.58      10,399.58      3,506.59       3,506.59       3,506.59           .00            .00            .00     13,906.17      13,906.17      13,906.17<br />  2. INCURRED BUT NOT REPORTED                                 1.12           1.12           1.12         11.84          11.84          11.84           .00            .00            .00         12.96          12.96          12.96<br />  3. ENDING UNEARNED PREMIUM AND IBNR                     10,400.70      10,400.70      10,400.70      3,518.43       3,518.43       3,518.43           .00            .00            .00     13,919.13      13,919.13      13,919.13<br /><br />G. AMORTIZED CEDING FEE<br />  1. XXXXXXXXXXXXXXXXXXXXXXXX                              .00            .00            .00           .00            .00            .00           .00            .00            .00           .00            .00            .00<br />  2. ENDING DEFERRED CEDING FEE                              519.83         519.83         519.83        175.31         175.31         175.31           .00            .00            .00        695.14       1,214.97         695.14<br />  3. XXXXXXXXX (B+G1-G2)                             .33            .33            .33          1.99           1.99           1.99           .00            .00            .00          2.32           2.32           2.32<br /><br />H. XXXXXXXXXXXXXXXXXX/(XXXXX)(A3+E3-F3)-(C+G3)=H          2.22           2.22           2.22         25.58          25.58          25.58           .00            .00            .00         27.80          27.80          27.80<br /><br />I. LOSS RATIOS<br />  1. XXXXXXXX(C+F2-E2)                                 1.12           1.12           1.12         11.84          11.84          11.84           .00            .00            .00         12.96          12.96          12.96<br />  2. EARNED PREMIUMS (A3+E3-F3)                                2.55           2.55           2.55         27.57          27.57          27.57           .00            .00            .00         30.12          30.12          30.12<br /><br />J. XXXXXXXXXX<br />  1. XXXXXX                                                      17             17             17             6              6              6             0              0              0            23             23             23<br />  2.XXXXX                                                    0              0              0             0              0              0             0              0              0             0              0              0<br />  3. NET                                                         17             17             17             6              6              6             0              0              0            23             23             23<br /><br />
</body>
</html> "

     Aspose.Pdf.Document pdf;
                
                Aspose.Pdf.HtmlLoadOptions htmlLoadOptions = new Aspose.Pdf.HtmlLoadOptions();
                MemoryStream outputstream = new MemoryStream();
                htmlLoadOptions.InputEncoding = "UTF-8";
                htmlLoadOptions.PageInfo.Margin.Left = 0;
                htmlLoadOptions.PageInfo.Margin.Right = 0;
                htmlLoadOptions.PageInfo.Margin.Top = 0;
                htmlLoadOptions.PageInfo.Margin.Bottom = 0;
                htmlLoadOptions.PageInfo.IsLandscape = true;
                htmlLoadOptions.PageInfo.DefaultTextState.FontSize= 7;
                       

                using (MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(pageSource)))
                {
                    pdf = new Aspose.Pdf.Document(stream, htmlLoadOptions); 

                }

                Aspose.Pdf.Facades.PdfFileEditor pfe = new Aspose.Pdf.Facades.PdfFileEditor();
                pfe.ResizeContents(pdf, Aspose.Pdf.Facades.PdfFileEditor.ContentsResizeParameters.PageResize(17 * 72, 11 * 72));



                pdf.Save(outputstream);
                byte[] bytes = outputstream.GetBuffer();
                HttpContext.Current.Response.Clear();
                HttpContext.Current.Response.AddHeader("content-disposition", string.Format("attachment; filename={0}", "xxx_List.pdf"));
                HttpContext.Current.Response.ContentType = "application/pdf";
                HttpContext.Current.Response.BinaryWrite(bytes);
                //  render the htmlwriter into the response                    
                HttpContext.Current.Response.End();

Print - fill paper

$
0
0
I have tried to set margins but the resulting pdf is not printed to edge of paper. Please let me know which exact properties to use in c# or vb.NET.

Font on Field Not Updating

$
0
0
Hello!

I'm trying to use a TrueType font  on a field in a PDF. The font is embedded in the document and I can use the font for text, but the field seems to be ignoring the font.

Apose version is 17.6.0

// Here I create my font object
Font steveFont = Aspose.Pdf.Text.FontRepository.OpenFont(@"C:\Work\TF_DEV\WOW.EAPP.Common\1_DEVL\WebServices\EAppServices\STEVE.TTF");
steveFont.IsEmbedded = true;

// Here I create my appearance object
var steveAppearance = new DefaultAppearance(steveFont, fontSize, System.Drawing.Color.DarkBlue);
steveAppearance.FontName = "SteveHandwriting";


// Later, I call this method to build the TextBoxField and pass steveAppearance to this method.
private TextBoxField CreatePiSigTextBox(Document pdfDocument, DefaultAppearance appearance)
{
    if (log.IsDebugEnabled) log.DebugFormat(CultureInfo.InstalledUICulture, $"CreatePiSigTextBox called");
    TextBoxField piSigTextBox = new TextBoxField(pdfDocument.Pages[page], GenerateSigRectangle(signatureCoordinates.piSigXpos, signatureCoordinates.piSigYpos));
    piSigTextBox.HorizontalAlignment = HorizontalAlignment.Left;
    piSigTextBox.PartialName = "SIG_X_APPCNT";
    piSigTextBox.DefaultAppearance = appearance;
    return piSigTextBox;
}

We tried some other fonts, too, but we can't see to get the field to change. Any suggestions?

Thanks!

Aspose.Pdf.Generator.Pdf

$
0
0
I just upgraded to the latest version 17.6 from version 17.4, and it appears that in the last version 17.5 Aspose.Pdf.Generator.Pdf was removed.

What are we supposed to use to convert an image to a pdf now?

Update Hyperlinks in PDF - It is very urgent

$
0
0
Hi

I need to replace a hyperlink (text and url) in a pdf document, I tried the following code

   foreach (Aspose.Pdf.Page page in document.Pages)            {                // Get the link annotations from particular page                Aspose.Pdf.InteractiveFeatures.Annotations.AnnotationSelector selector = new Aspose.Pdf.InteractiveFeatures.Annotations.AnnotationSelector(new Aspose.Pdf.InteractiveFeatures.Annotations.LinkAnnotation(page, Aspose.Pdf.Rectangle.Trivial));                page.Accept(selector);                // Create list holding all the links                System.Collections.IList list = selector.Selected;                // Iterate through invidiaul item inside list                foreach (Aspose.Pdf.InteractiveFeatures.Annotations.LinkAnnotation a in list)
                {
string url = (a.Action as Aspose.Pdf.InteractiveFeatures.GoToURIAction).URI;                    if (url == "https://www.aspose.com/community/forums/addpost.aspx?ForumID=20")                    {                        Console.WriteLine("<br />Destination: " + (a.Action as Aspose.Pdf.InteractiveFeatures.GoToURIAction).URI + "<br />");
                        a.Action = new GoToURIAction(@"www.google.com");
break;
}
}
}		
   document.Save(filename1);

It changes the URL of the hyperlink but not the text. How to change the display text, I tried two methods
simple text replace which replaced but I can see a long underline after the hyperlink text
then I tried the following...
// a is retrieved from the above code ***
                        TextFragmentAbsorber ta = new TextFragmentAbsorber();                        Aspose.Pdf.Rectangle rect = a.Rect;                        rect.LLX -= 10;                        rect.LLY -= 10;                        rect.URX += 10;                        rect.URY += 10;                        ta.TextSearchOptions = new TextSearchOptions(rect);                        ta.Visit(document.page);  // page is coming from the above logic                        // Change color and text.                        foreach (TextFragment tf in ta.TextFragments)                        {                            tf.TextState.ForegroundColor = Aspose.Pdf.Color.Red;                            tf.Text = "Click Here";                        }                        break;

but this replaces  the text but many times as attached(after.img), "Click Here" is appeared many times in the same sentence and the hyperlink format (underline and blue colored text are not disappearing from the previous long URL)
It would be helpful if you give me some suggestion to resolve this issue ,its bit urgent.
otherwise, what is the best way to delete the existing hyperlinks (text and url) and add a new one at the same location? can I have the sample code ?

Please check the attached images.
Regards
Sam.



Convert PDF to Excel with all images found in PDF document?

$
0
0
Hi Aspose team,

I would like to convert PDF to Excel with following code:

               Document document = new Document("SomeDocument.pdf");
                ExcelSaveOptions saveOptions = new ExcelSaveOptions();
                saveOptions.InsertBlankColumnAtFirst = false;
                saveOptions.MinimizeTheNumberOfWorksheets = true;
                document.Save("NewDocument.xls", saveOptions);

It created XLS document but I do not have a single images from PDF document. Only text is exported.

What would you recommend to be used to convert PDF to Excel where images in PDF document are also included?

Thx

java.awt.HeadlessException thrown when converting HTML to PDF

$
0
0
Updating to Aspose PDF for Java 17.3.0 and higher throws an exception while trying to convert an HTML file to PDF under headless environments:

java.awt.HeadlessException
at sun.awt.HeadlessToolkit.getScreenSize(HeadlessToolkit.java:284)
at com.aspose.pdf.internal.p340.z5.<init>(Unknown Source)
at com.aspose.pdf.internal.p312.z5.m1(Unknown Source)
at com.aspose.pdf.internal.p296.z3.m1(Unknown Source)
at com.aspose.pdf.internal.p312.z5.<init>(Unknown Source)
at com.aspose.pdf.internal.p296.z3.<init>(Unknown Source)
at com.aspose.pdf.z88.m1(Unknown Source)
at com.aspose.pdf.z88.m1(Unknown Source)
at com.aspose.pdf.z88.m1(Unknown Source)
at com.aspose.pdf.z88.m1(Unknown Source)
at com.aspose.pdf.ADocument.m1(Unknown Source)
at com.aspose.pdf.ADocument.<init>(Unknown Source)
at com.aspose.pdf.Document.<init>(Unknown Source)

I'm attaching a maven project with a test case to demonstrate the problem.

Password rules for encrypting files

$
0
0
My application encrypts PDF files with line:
EncryptFile(userPassword, ownerPassword, DocumentPrivilege.AllowAll, KeySize.x128, Algorithm.AES)

I got exception 
Exception: System.IO.IOException: Bad password!: v5.6.0.0
   at Aspose.Pdf.Kit.PdfFileSecurity.EncryptFile

The password looks like that ABC2EFG2016 .

Is that because the password format is not good? What are the rules on which password is valid?

Update demos and showcases

$
0
0
Your demos and showcases need to be updated to reflect your recent changes.

https://github.com/aspose-pdf/Aspose.Pdf-for-.NET

Multiline Aspose.Pdf.Forms.RichTextBoxField Line-Height

$
0
0

Could you please provide samples of a supported RichTextValue that will allow setting the line-height for each line of a multiline Aspose.Pdf.Forms.RichTextBoxField?

I’ve tested with the Xml value below, but it causes errors when opening the Pdf.

“An error exists on this page. Acrobat may not display the page correctly. Please contact the person who created the PDF document to correct the problem.”

<?xml version=\"1.0\"?><body xfa:APIVersion=\"Acroform:2.7.0.0\" xfa:spec=\"2.1\" xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:xfa=\"http://www.xfa.org/schema/xfa-data/1.0/\"><p dir=\"ltr\" style=\"margin-top:0pt;margin-bottom:0pt;line-height:7pt;font-family:Arial;font-size:7pt\">1</p><p dir=\"ltr\" style=\"margin-top:0pt;margin-bottom:0pt;line-height:7pt;font-family:Arial;font-size:7pt\">2</p><p dir=\"ltr\" style=\"margin-top:0pt;margin-bottom:0pt;line-height:7pt;font-family:Arial;font-size:7pt\">3</p><p dir=\"ltr\" style=\"margin-top:0pt;margin-bottom:0pt;line-height:7pt;font-family:Arial;font-size:7pt\">4</p><p dir=\"ltr\" style=\"margin-top:0pt;margin-bottom:0pt;line-height:7pt;font-family:Arial;font-size:7pt\">5</p><p dir=\"ltr\" style=\"margin-top:0pt;margin-bottom:0pt;line-height:7pt;font-family:Arial;font-size:7pt\">6</p><p dir=\"ltr\" style=\"margin-top:0pt;margin-bottom:0pt;line-height:7pt;font-family:Arial;font-size:7pt\">7</p><p dir=\"ltr\" style=\"margin-top:0pt;margin-bottom:0pt;line-height:7pt;font-family:Arial;font-size:7pt\">8</p><p dir=\"ltr\" style=\"margin-top:0pt;margin-bottom:0pt;line-height:7pt;font-family:Arial;font-size:7pt\">9</p><p dir=\"ltr\" style=\"margin-top:0pt;margin-bottom:0pt;line-height:7pt;font-family:Arial;font-size:7pt\">10</p></body>

 

Thanks for your help...

Viewing all 1038 articles
Browse latest View live