Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Thu Dec 05, 2024 10:35 am

We have the following scenario:

- Application A produces a PDF with TextBoxes in them by using Spire.PDF for Java
- Application B reads these PDF and writes text into the prepared TextBoxes by using Spire.PDF for .Net
- Application C reads these PDF and writes text into the prepared TextBoxes by using Spire.PDF for Android

We upgraded to a new Spire.PDF for Java version and now our .Net and Android applications can no longer write into these textboxes.

The attached test projects show that PDFs produced by Spire.PDF for Java V9.5.6 worked and all the later version have textboxes which we cannot write to with Spire.PDF for .Net!

Since writing into the textboxes with Android also doesn't work anymore, we suspect that the Java version somehow produces invalid textboxes.

RicoScheller
 
Posts: 52
Joined: Tue Jul 02, 2019 10:34 am

Fri Dec 06, 2024 5:14 am

Hello,

Thanks for your inquiry.

I have reproduced the issue you encountered and have logged it into our issue system with the tracking number SPIREPDF-7251.It has been given the highest priority.

We apologize for any inconvenience caused and will keep you updated on the progress of the issue.

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 3011
Joined: Wed Jun 27, 2012 8:50 am

Tue Dec 31, 2024 8:39 am

Hello,

Thank you for your patience.

I'm glad to inform you that SPIREPDF-7251 has been resolved. Welcome to download and test [Spire.PDF for Java Version:10.12.10].
Our website link: https://www.e-iceblue.com/Download/pdf-for-java.html
Install from Maven Repository:
Code: Select all
<repositories>
    <repository>
        <id>com.e-iceblue</id>
        <name>e-iceblue</name>
        <url>https://repo.e-iceblue.com/nexus/content/groups/public/</url>
    </repository>
</repositories>

<dependency>
    <groupId>e-iceblue</groupId>
    <artifactId>spire.pdf</artifactId>
    <version>10.12.10</version>
</dependency>



If you have any questions, please let us know.

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 3011
Joined: Wed Jun 27, 2012 8:50 am

Mon Jan 06, 2025 9:27 am

Hello

Unfortunately, I am not able to successfully verify this.
If I use the test setup that I provided in the first post, and generate a PDF with Spire.PDF for Java 10.12.10, Spire.PDF for .Net 10.12.4 (current version) is still not able to add text to the text field.

Can you please run my examples yourself and tell me if it works for you?

RicoScheller
 
Posts: 52
Joined: Tue Jul 02, 2019 10:34 am

Mon Jan 06, 2025 10:03 am

Hello,

Thank you for your feedback.

Indeed, I am using the same code you provided. However, my tests with Spire.PDF for Java 10.12.10 and Spire.PDF for .NET 10.12.4 show no issues. The form fields document generated by Spire.PDF for Java 10.12.10 can be successfully filled with values using Spire.PDF for .NET 10.12.4.

Below is the code I used:
For generating a form field document with Spire.PDF for Java 10.12.10:
Code: Select all
PdfDocument pdf = new PdfDocument();
pdf.getFileInfo().setVersion(PdfVersion.Version_1_7);

PdfTextBoxField textBox = new PdfTextBoxField(pdf.getPages().add(PdfPageSize.A4, new PdfMargins(40)), "textbox");
textBox.setBounds(new Rectangle2D.Float(0, 100, 500, 60));
pdf.getForm().getFields().add(textBox);

pdf.saveToFile(path + PdfDocument.class.getPackage().getImplementationVersion() + ".pdf");
pdf.close();


For filling the form fields with Spire.PDF for .NET 10.12.4:
Code: Select all
WritePdf(path + "10.12.10.pdf");

static void WritePdf(string inputPath)
{
    PdfDocument doc = new PdfDocument();
    doc.LoadFromFile(inputPath);

    PdfFormWidget formWidget = doc.Form as PdfFormWidget;
    for (int i = 0; i < formWidget.FieldsWidget.List.Count; i++)
    {
        if (formWidget.FieldsWidget.List[i] as PdfField is PdfTextBoxFieldWidget textBoxField)
        {
            textBoxField.Text = $"This is a text from C# {textBoxField.Name}";
        }
    }

    doc.SaveToFile("10.12.4_CSharp.pdf");
    doc.Close();
}


I have also attached the document that I generated.

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 3011
Joined: Wed Jun 27, 2012 8:50 am

Mon Jan 06, 2025 4:11 pm

Oh, ok, I see now what's going on:

- When I write into the text field, it doesn't show when using PDF-XChange-Editor, but it shows using Adobe Acrobat Reader or any web browser (see MissingTextInPdfXChange.png)
- When I close it in Adobe Acrobat Reader, it asks to save the file although I didn't change anything.
- If I save it, the text is also visible with PDF-XChange
- The same thing happens when I open the PDF directly after it is produced by Spire.PDF for Java.

Since I can see the text in your file, I assume that you opened it in Adobe and saved it, which meant Adobe "fixed" it.

Adobe telling me to save it seems to indicate that the original PDF was not correct and Adobe does something to fix it.
But all the browsers display the "corrupt" PDF normally and I can also use Spire.PDF for .Net to read back the value inside the text field.

Thus, I think Spire.PDF produces a text field with errors which PDF-XChange handles differently than the rest of the PDF viewers and Adobe fixes the issue when saving the document.

Can you confirm that Adobe asks to save the file after it has been created by Spire.PDF for Java?
And if yes, could you maybe check with the developers if they know what this is?

According to https://community.adobe.com/t5/acrobat-discussions/disable-quot-do-you-want-to-save-changes-before-closing-quot/td-p/9610310:
You may not have modified the document, but behind the scenes, something happened that makes the document different than it was at the time it was loaded into Acrobat. This can be either due to some JavaScript calculation in the document, or due to a problem with the PDF file that was fixed by Acrobat.

RicoScheller
 
Posts: 52
Joined: Tue Jul 02, 2019 10:34 am

Tue Jan 07, 2025 2:39 am

Hello,

Thank you for your feedback.

Adding `pdf.getForm().setNeedAppearances(false);` in the Java code can resolve the issue of Adobe prompting to save changes when opening and closing the PDF file. However, after filling out the form fields with the .NET product, the values disappear when the fields are clicked with the mouse. I have logged this issue in our system with the tracking number SPIREPDF-7312.

I will notify you once the problem has been resolved.

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 3011
Joined: Wed Jun 27, 2012 8:50 am

Wed Jan 08, 2025 12:30 pm

Ok, thank you.

Do you know if it's planned for this to be a hotfix which is released as soon as possible, or is this targeted for a normal end-of-the-month release?

Either we can include this in our scheduled January release so that we can reliably use PDF-XChange to view the documents after filling them out. Or if a hotfix is not possible we would have to cancel our January release and wait for March.

RicoScheller
 
Posts: 52
Joined: Tue Jul 02, 2019 10:34 am

Thu Jan 09, 2025 6:52 am

Hello,

I have communicated with the developers regarding the SPIREPDF-7312 issue. If everything goes as planned, a fix version should be released by the end of this month. May I ask when in January you are planning to release your product? We will evaluate whether we can provide the fix to you before your planned release date.

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 3011
Joined: Wed Jun 27, 2012 8:50 am

Mon Jan 20, 2025 9:56 am

Hello,

Thank you for your patience.

I'm glad to inform you that SPIREPDF-7312 has been resolved. Welcome to download and test [Spire.PDF Pack(Hot Fix) Version:11.1.5].

Our website link: https://www.e-iceblue.com/Download/download-pdf-for-net-now.html
NuGet links:
https://www.nuget.org/packages/Spire.PDF/11.1.5
https://www.nuget.org/packages/Spire.PDFfor.NETStandard/11.1.5

If you have any questions, please let us know.


Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 3011
Joined: Wed Jun 27, 2012 8:50 am

Tue Jan 21, 2025 1:45 pm

Hey

Thank you for the fast implementation.
I can confirm that this fix works.

Crucial, however, was really the
Code: Select all
pdf.getForm().setNeedAppearances(false);
because without it PDF-XChange displayed things wrong, for example didn't wrap text in the text boxes even though the multiline property was set.

Now, having set this flag to false, everything looks like it should on every PDF-Viewer I tested!

RicoScheller
 
Posts: 52
Joined: Tue Jul 02, 2019 10:34 am

Wed Jan 22, 2025 1:26 am

Hi,

Thanks for your feedback. I'm glad to hear that it works.

Please feel free to contact us if you need any assistance.

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 3011
Joined: Wed Jun 27, 2012 8:50 am

Return to Spire.PDF