Error while converting html page to pdf
aspose.pdf TextFragmentAbsorber to use existing form
RadioButtonOptionField Crashes when trying to place in Tabel Cell
I am trying to add RadioButtonOptionField to a tabel cell, But it is throwing the NullPointerException. I don't want to mention Rectangle parameter because i need to add it to a table cell than fixing the position using rectangle.
Version: aspose.pdf-16.10.0.jar
Error:
at com.aspose.pdf.Annotation.m1(Unknown Source)
at com.aspose.pdf.WidgetAnnotation.m1(Unknown Source)
at com.aspose.pdf.Field.m1(Unknown Source)
at com.aspose.pdf.Annotation.m1(Unknown Source)
at com.aspose.pdf.RadioButtonField.add(Unknown Source)
Code:
Table table = new Table();
table.setMargin(new MarginInfo(20, 20,10, 0));
table.setColumnWidths("50 50");
pdfPageItem.getParagraphs().add(table);
RadioButtonField radio = new RadioButtonField(pdfPageItem);
RadioButtonOptionField opt1 = new RadioButtonOptionField(); -- > Null exception here
opt1.setOptionName("Test1");
opt1.setName("Test1");
opt1.setCaption(new TextFragment("Test1"));
Row row = table.getRows().add();
Cell cellYesField = row.getCells().add();
cellYesField.getParagraphs().add(opt1);
pdfDoc.getForm().add(radio);
pdfDoc.save("Sample.pdf");
Please let me know how i can add the options to a table cell rather than using fixed coordinates using rectangle.
Thanks,
Leena Robert
Embed glyphs into PDF
Is it possible to embed only used glymphs into the PDF?
I searched through the documentation, but only found something like RemoveDuplicatedFonts and RemoveSimilarFontsWithDifferentWidths. That is not what I want.
I want to know whether it is possible to tell aspose to embed only the glyphs that are actually used, instead of the whole font.
The problem I have is that the PDF gets very large when using certain fonts. If I use "NotoSansCJKjp-Regular" font from Google Noto Fonts, the document increases in size with more than 10MB.
The code snippet below demonstrates this issue. There is one table and 2 cells with some text. The result is saved in the attachment: "ResultNoto.pdf".
If I comment out the line of code that specifies usage of "NotoSansCJKjp-Regular", the resulting PDF more than 10MB smaller: "Result.pdf".
The files are attached and the sample code is below:
List<String> fontPaths = com.aspose.pdf.Document.getLocalFontPaths();
fontPaths.add("C:\\temp\\Noto-hinted");
com.aspose.pdf.Document.setLocalFontPaths(fontPaths);
List<String> inputStringList = new ArrayList<>();
inputStringList.add("äöüß é ç Здравствуйте 3 df a dad a END");
inputStringList.add("äöüß é ç Здравствуйте 昨夜のコンサートは最高でし adsf dfg END");
com.aspose.pdf.Document doc = new com.aspose.pdf.Document("Blank.pdf");
com.aspose.pdf.Table table = new com.aspose.pdf.Table();
table.getDefaultCellTextState().setFont(com.aspose.pdf.FontRepository.findFont("NotoSansCJKjp-Regular"));
table.setColumnWidths("400");
for (String currentString : inputStringList) {
Row row = table.getRows().add();
row.getCells().add(currentString);
}
I am using aspose.pdf verson 11.8.0
Thank you,
Samuel
How to change PDF Metadata
Is relative css possible with Aspose when converting pdf to html?
I have a situation where pdfs needs to be translated to different languages. The process is to first convert it into html and the pass the html as input to translator API. Translator returns the translated html with original html tags intact. Now if the translated text isn't of the same size of text in original language then overlapping happens and the readability is affected. So want to know if relative stylingpossible with Aspose. Attaching picture of position styling generated by Aspose.
Regards,
Amit
Replaced content not reflowing
Hyperlink in HtmlFragment Text
How to set ImageFileType for Image
Hi Team,
I am getting image as bytes from database and that bytes may be of a png or jpeg mage.
How can specify the ImageFileType for an Image control in pdf.
Document pdfDoc = new Document();
pdfDoc.getPageInfo().getMargin().setLeft(10);
pdfDoc.getPageInfo().getMargin().setRight(20);
pdfDoc.getPageInfo().getMargin().setTop(10);
pdfDoc.getPageInfo().getMargin().setBottom(10);
pdfDoc.getPages().add();
Image img1 = new Image();
img1.setFixHeight(50);
img1.setFixWidth(50);
ByteArrayInputStream bstream = new ByteArrayInputStream(bytes);
img1.setImageStream(bstream);
pdfPageItem.getParagraphs().add(img1);
pdfDoc.save("Sample.pdf");
Thanks
Leena Robert
Table Page Break (PDF)
Hello!
I am trying to stop Aspose PDF from page breaking in the middle of a table in C# .NET. I have not found any answers that have solved this problem through Google, Stackoverflow, or this forum.
We have a table with two rows that must always be together as they are utilized as a header. These rows are currently being split sometimes when they happen to fall on a page break. I wish to stop this from happening.
I have found the table.isBroken
attribute always returns true and row.isRowBroken
always returns false (from Aspose). This does not help me to stop the page from breaking in the middle of this table.
Here is a link to the post on stackoverflow: http://stackoverflow.com/questions/42079506/do-not-page-break-on-table-in-aspose-pdf-c-sharp-asp-net
Thank you for your time!
PDF Margin info giving me same values always
How to set background colour of a FreeTextAnnotation
new Pdf.InteractiveFeatures.DefaultAppearance("Arial", fontSize, color); Pdf.InteractiveFeatures.Annotations.FreeTextAnnotation annotation = new Pdf.InteractiveFeatures.Annotations.FreeTextAnnotation(page, new Pdf.Rectangle(llx, lly, urx, ury), appearance);
TIA
Dan
PDF to PDF conversion with image downsampling
Add Image as annotation to PDF
Grouped Check-boxes code not working
Issue with latest version of Aspose.Pdf dll
PDF Split Sample Source code based on the PDF file Size
PDF File with Signature
System.NullReferenceException: Object reference not set to an instance of an object.
PDF to HTML problem when viewing html in Edge browser.
We are converting documents from PDF to HTML for display in a web application.
For some documents, it appears there is a problem when viewing in Edge.
The image is obscured by the text unless you resize the browser window just so.
Firefox, Chrome, IE 10 and IE 11 do not show such an issue.
We are saving to a single stream with embedded resources using code similar to the documentation samples.
Is this known behavior in the Edge browser and do you have a way to work around the issue?
I have attached an example of the PDF and the generated HTML in a zip file.
Thanks,
Patrick