Stirling-Tools / Stirling-PDF

#1 Locally hosted web application that allows you to perform various operations on PDF files
https://stirlingpdf.com
MIT License
43.44k stars 3.52k forks source link

[Bug]: flatten form field with text inside. Text is lost. #2006

Open samsong opened 2 hours ago

samsong commented 2 hours ago

Installation Method

None

The Problem

When I flatten a pdf with lots of form fields. I expect the text inside the forms to be saved and only form field removed.

Stirling remove all. No text visible after.

Is this a bug or design and how can I save the text inside the form field?

Version of Stirling-PDF

0.29

Last Working Version of Stirling-PDF

No response

Page Where the Problem Occurred

No response

Docker Configuration

No response

Relevant Log Output

No response

Additional Information

No response

Browsers Affected

No response

No Duplicate of the Issue

Frooodle commented 2 hours ago

Seems like a bug could you provide an example pdf for testing?

iib0011 commented 2 hours ago

Will work on this. Waiting for pdf

samsong commented 2 hours ago

I've just run it again and I ticked the box "flatten form fields only" this time it worked it preserved the form but there's a partial corruption of the file meaning when I open the pdf in my pdf editor (pdf xchange) it reports red flag warning "ERRORS DETECTED IN THE XREF TABLE"

is this something expected or simple? i know it's not a big deal and could be ignored but i wish to find a way to clear this.

i will provide a sample pdf asap for you to test with yourself.

samsong commented 2 hours ago

sample file. so if you tick "flatten form fields only" it works & preserves the text. but need to resolve the errors XREF after flattening.

STIRLINGPDF_SAMPLE_FORM.pdf

Screenshot_1
iib0011 commented 1 hour ago

@Frooodle can you assign me?

samsong commented 1 hour ago

Separate question. I want to use this as a web api but I cannot load the api documentation on swagger it is stuck on loading page.

Can you tell me what is the web api command to do flatten + form fields only?

iib0011 commented 45 minutes ago

@Frooodle this works https://stackoverflow.com/a/71159599.

editing pdfDocToWebResponse

        document.save(baos, CompressParameters.NO_COMPRESSION);

Is it worth it?