stephanrauh / ngx-extended-pdf-viewer

A full-blown PDF viewer for Angular 16, 17, and beyond
https://pdfviewer.net
Apache License 2.0
449 stars 167 forks source link

Visualizing an editable pdf file incorrectly rendered #2347

Closed dev080 closed 3 weeks ago

dev080 commented 1 month ago

We have issues with our pdf fillable (cerfa, official medical documents).

our first configuration was angular 15 - ngx extended-viewer 17 were this bug don't exist. we have upgraded to ngx extended viewer 18. the bug appeared

now we are in angular 16 and ngx-extended-viewer 19.7.1 the bug is still present

concretely we insert data from our bdd in the pdf and send to angular for displaying. but the text fill in a textfield loose his formatage (line break \r\n)

image

see the difference between the viewer and edge (browser).

Thank you in advance for your answers

stephanrauh commented 1 month ago

That sounds like a difficult issue. Let's try to tackle it nonetheless.

dev080 commented 4 weeks ago

in mozilla showcase all is good,

bdd si just our database, where we first stock the data contained by the pdf before filling it

the filling of the pdf is donne under nodejs with "pdf-lib" we have named all the fields and we have an object with the data (data). we browse the form (getfields()) we recup the field name, const name=field.getName() and we set the field content, field=setText(data[name]).

after we flatten the form and save the pdfDocument write it to a directory. And return is path to angular, after we show a modal with the pdf viewer where display has an issue.

I cannot provide the editable cerfa version we made as it is document which permit deliverance of medicament.

i was not sure about the usage of [formData] i remove it and no changes.

I have an last informations the issue don't exist in "^20.5.0-alpha.0", so we decided to use it

stephanrauh commented 3 weeks ago

Sorry for answering late. I assume pdf-lib is this library? https://www.npmjs.com/package/pdf-lib

What about version 20.5.0? Can you still confirm it solves your issue?

If so, that's probably the reason why everything looked fine in the Mozilla showcase. Probably they've solved the issue recently, and my stable fork of pdf.js is always one or two version behind. The most likely explanation is my fork didn't contain the bugfix before version 20.5.0.

As for the alpha version: at the moment, I believe the quality is high, but I want to test it thoroughly before making it an official version. Generally speaking, I don't recommend using an alpha version in production, but in this particular version, it's just that I don't manage to find some spare time for testing.

I'll close the issue now. If you think there's something I should do for you, don't hesitate to tell me.

Bonsoir Stephan