How to hide measurement annotations
Increase character spacing while replace text in PDF
Open Type font support
Aspose.PDF lost all the layers after optimize file size
Problem with textsegments not keeping colors
TIF file conversion issue
Making PDF Form Fields Read Only
for (Field field : pdfDoc.getForm().getFields()) {
makeFieldReadOnly(field);
}
private static void makeFieldReadOnly(Field field) {
field.setReadOnly(true);
for (int i = 0; i < field.size(); i++) {
makeFieldReadOnly((Field)field.get_Item(i));
}
}
The problem is that not all of the nested form fields are set to read only as they should be - I think it is because the field.size and field.get_item calls are not giving access to the child form fields as they should.
I'm attaching two documents to illustrate the problem:
original+form.pdf - This is the original PDF form
resulting+doc.pdf - This document is a merge of two of the above forms that has been processed using the above code snippet. If you look at the checkboxes you can see that some have correctly been set as read only, but some have not (the problem being that we need all the fields set to read only).
Converting Large TIF Images to PDF
PageInfo.IsLandscape returning inaccurate Information
Cell Border Issue
How FitToContent and IsWordWrapped in table and cell works
Please refer attached PDF, I have set column adjustment property to auto fit to content.
And i have set IsWordWrapped property to false.
but it is wrapping the text.
I want column to be resized according to the largest fragment without word wrapping.
Like in attached document I want ABCD EFGH in single line only.
how this can be achieved?
Azure Storage
Text goes beyond cell definition when text includes certain characters
I am using aspose pdf in order to fill in text in a table. I noticed that sometimes the text goes beyond the cell definition. I noticed that this happens when the text contains Japanese characters, for example. Text containing only English characters does not suffer from this problem, even inside the same table.
The code snippet below demonstrates this issue. There is one table and 2 cells with a lot of text. The text from the second cell contains some Japanese characters. The result is saved in the attachment: "Result.pdf".
List<String> inputStringList = new ArrayList<>();
inputStringList.add("asd as ADFWgsfgs df fg43 df a dad a dsasd as ADFWgsfgs df fg43 df a dad a dsasd as ADFWgsfgs df fg43 df a dad a dsasd as ADFWgsfgs df fg43 df a dad a END");
inputStringList.add("The signer signer1 in signing package 昨夜のコンサートは最高でし has been manually authenticated. Passport authentication was completedEND");
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("Helvetica"));
table.setColumnWidths("400");
for (String currentString : inputStringList) {
Row row = table.getRows().add();
row.getCells().add(currentString);
}
doc.getPages().get_Item(1).getParagraphs().add(table);
doc.save("Result.pdf");
I noticed that removing the default font solves the problem, but I also need the table default font.
The same behavior is present under Windows and Linux.
The version of aspose.pdf is 11.8.0, but the problem is still present in the latest version.
Is this a bug? Is there any way to tweak the code in order to fix this problem?
Thank you,
Samuel
Issue with latest version of Aspose.Pdf dll
Multiple text in fragment
I am generating PDF using aspose java api. I like to combine different texts together in the same paragraph. For ex: i have a text followed by ------------------, a line to enter something and again text and a line to enter something. I tried to achieve this by adding fragement and having segments added to fragment. abut i am unable to add line to fragement. Also is there any way to mention font stlying for the entire PDF?
Thanks,
Gomathi R
Not able to flatten form and radio button and place form dynamically
I am having a PDF which have editable and non-editable part.
My requirement is that I should be able to make the editable part non editable depending on a configuration.
I have added controls like CheckboxField, RadioButtonOptionField, TextBoxField.
These controls I have added to a table which suits my requirement.
Is it necessary that I have to add the editable control to a Form?
If I add it to form the control shows up in two place. One in the table where I have placed according to the pdf design and also on the first page as I am adding to pdf.getForm().add(field, 1)
If I don't place the fields in the form I would not be able to flatten the PDF to make it non editable.
I am also not able to add the table to the Form as it allows only field item.
As per requirement I would not be able to place the form in any static location like Rectangle as my data remains dynamic and can grow to any extend.
Please let me know if there is a way to make the form visibility false so that non of my fields are repeated twice, also please let me know if there any work around.
Code:
static void Create() throws FileNotFoundException
{
Booleam isPdfEditable = false;
pdfDoc = new Document();
pdfPageItem = pdfDoc.getPages().add();
pdfPageItem.getParagraphs().add(NonEditableContent()); --- > Implementation not provided in code
pdfPageItem.getParagraphs().add(GetTable());
if(!isPdfEditable)
{
pdfDoc.flatten();
pdfDoc.getForm().flatten();
Field[] fields = pdfDoc.getForm().getFields();
for(Field field : fields)
{
field.flatten();
}
}
pdfDoc.save("Sample.pdf");
}
private static Table GetTable()
{
Table questionTable = new Table();
questionTable.setMargin(pdfDoc.getPageInfo().getMargin());
questionTable.setColumnWidths("20 500");
RadioButtonField rf = new RadioButtonField(pdfDoc);
rf = new RadioButtonField(pdfPageItem);
rf.setPartialName("radio");
Row r2 = questionTable.getRows().add();
Cell c2 = r2.getCells().add();
Cell c3 = r2.getCells().add();
c2.setVerticalAlignment(com.aspose.pdf.VerticalAlignment.Top);
c2.setWordWrapped(true);
c3.setVerticalAlignment(com.aspose.pdf.VerticalAlignment.Bottom);
c3.setWordWrapped(true);
RadioButtonOptionField opt1 = new RadioButtonOptionField();
opt1.setOptionName("Name");
opt1.setWidth(10);
opt1.setHeight(10);
rf.add(opt1);
pdfDoc.getForm().add(opt1, 1);
RadioButtonOptionField opt2 = new RadioButtonOptionField();
opt2.setOptionName("Name");
opt2.setWidth(10);
opt2.setHeight(10);
rf.add(opt2);
pdfDoc.getForm().add(opt2, 1);
c2.getParagraphs().add(opt1);
c3.getParagraphs().add(opt2);
CheckboxField chk1= new CheckboxField(pdfDoc);
chk1.setPartialName("ch");
chk1.setWidth(10);
chk1.setHeight(10);
Border border = new Border(chk1);
border.setWidth(2);
border.setStyle(BorderStyle.Solid);
chk1.setBorder(border);
chk1.getCharacteristics().setBorder(java.awt.Color.BLACK);
pdfDoc.getForm().add(chk1, 1);
TextBoxField textBoxField1 = new TextBoxField(pdfDoc);
textBoxField1.setPartialName("tb");
textBoxField1.setHeight(30);
textBoxField1.setWidth(500);
textBoxField1.setInLineParagraph(true);
textBoxField1.setMultiline(true);
pdfDoc.getForm().add(textBoxField1, 0);
Row r3 = questionTable.getRows().add();
Cell c4 = r3.getCells().add();
Cell c5 = r3.getCells().add();
c4.getParagraphs().add(chk1);
c5.getParagraphs().add(textBoxField1);
return questionTable;
}
RightToLeft (RTL) lang support broken for pdf?
IsHtmlTagSupported
Issue with Aspose.PDF version 16.12
This is an urgent matter as it involves our production deployment. I appreciate a prompt response.
Thanks
Exception Message: Could not load file or assembly 'Aspose.Pdf, Version=9.1.0.0
We installed provided package with
Aspose trial license. During POC, we observed PDF generation failed and we got
following errors in SharePoint logs.
10/02/2017 06:10:49 -- Exception Source: SABMiller.BTF.Application Exception Message: Could not load file or assembly 'Aspose.Pdf, Version=9.1.0.0, Culture=neutral, PublicKeyToken=47b2d0fcacdd3eb6' or one of its dependencies. The system cannot find the file specified. Exception StackTrace: at SABMiller.BTF.Application.PDFGeneration.renderPDF(SPListItem CurrItem, String Filter)
at
SABMiller.BTF.Application.PDFGeneration.<Page_Load>b__0()
at
Microsoft.SharePoint.SPSecurity.<>c__DisplayClass4.<RunWithElevatedPrivileges>b__2()
at
Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated
secureCode)
at
Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback
secureCode, Object param)
at
Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated
secureCode)
at
SABMiller.BTF.Application.PDFGeneration.Page_Load(Object sender, EventArgs e)
on10/02/2017 06:10:49
While in our current SP 2010 farm, Aspose 9.1.0.0 dll is present in Windows GAC and PDF generation is working fine.We are using "Aspose Total for .NET" license there.
In new SP 2010 farm, Aspose 9.1.0.0 dll is missing and causing issues.
In which setup we can find "Aspose 9.1.0.0 dll"?
Thanks in advance.