Out of memory exception
Page numbers are not showing in footer - PDF
Issue here is:
When I convert document from HTML to PDF (using download option), page numbers are not showing.
Html for footer is:
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
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
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.
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 |
---|---|---|---|
4 | 6.4 Limit of Liability | test | |
3 | 6.5 Indirect and Consequential Damages | 4 | test |
Could you please help us to resolve this issue. We will definitely appreciate your help.
Thanks & Regards,
Faisal. N
Extract table from pdf
How to add Tooltip to a cell using ASPOSE API
<Table ColumnWidth="100%"><row><cell><segment> Hi How are you..! </segment></cell></row></Table>
Is it possible to have TextAnnotation in XML
is it possible to use a TextAnnotation in XML format like how we would use Segment or Attachment?
Thank you
pranusha
HtmlLoadOptions for HtmlFragment
row = table.getRows().add();HtmlFragment html = new HtmlFragment(i.getComments());
c = row.getCells().add();
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
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
Convert HTML to PDF - change font, margin and size
Print - fill paper
Font on Field Not Updating
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
Update Hyperlinks in PDF - It is very urgent
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.RegardsSam.
Convert PDF to Excel with all images found in PDF document?
ExcelSaveOptions saveOptions = new ExcelSaveOptions();
saveOptions.InsertBlankColumnAtFirst = false;
saveOptions.MinimizeTheNumberOfWorksheets = true;
document.Save("NewDocument.xls", saveOptions);
java.awt.HeadlessException thrown when converting HTML to PDF
Password rules for encrypting files
Update demos and showcases
Multiline Aspose.Pdf.Forms.RichTextBoxField Line-Height
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...