The problem is that if I do what the other programs to (ignore the /Type entry) then I lose the stack overflow protection.

What you could do is to open the file with NOTEPAD++ (it is readable!), search for this:

1 0 obj
<</Type /Pages /Count 1
/Kids[
4 0 R
]
/Type /Page

now make sure your keyboard is in "overwrite" mode, then replace "/Type /Page" with the _same amount_ of spaces.

Ideally you should contact that customer, and tell it that the PDF incorrect, that it contains two "/Type" entries, one with "Page*s*" and one with "Page". Your customer should forward this information to the entity that created this PDF file.

That this PDF is so easily readable with an editor makes me suspect that this wasn't created by some tool, but by a lonely "hardcore" developer who creates these PDFs without any external tool so the employer can avoid licensing a tool. (I know such people exist because I met one last year. )

Tilman

On 06.12.2024 08:39, Marco Barbi - Credemtel SpA wrote:
Hi,

thank you very much for your quick reply, I will be following the JIRA.

Concerning your latest question, unfortunately I cannot say how the PDF was
composed since we basically provide a SaaS platform where customers upload
PDF documents for being processed, then we have no control on the very
early composition stage. However, most likely it could be the result of a
printing function implemented in the customer ERP system.

Regards,
Marco

Il giorno gio 5 dic 2024 alle ore 17:52 Tilman Hausherr <
thaush...@t-online.de> ha scritto:

Hi,

Your issue has been created here:
https://issues.apache.org/jira/browse/PDFBOX-5910

You initially wrote to the wrong mailing list and I got your file from
the moderation too. See the comments there why this happens (dictionary
with duplicate keys and we get the "wrong" one)

Did you create this file yourself / in your company?

Tilman

On 05.12.2024 17:19, Marco Barbi - Credemtel SpA wrote:
Hi,

we have been facing a rendering issue using pdfbox 2.x (we are able to
reproduce the issue with the latest 2.0.32 and previous versions too,
we hadn't checked with the 3.x).

In detail, by applying the following snippet to some PDF files, the
final images are rendered as a portrait-LAYOUT page (with some cropped
text) instead of landscape as per the original PDF.

try (InputStream in = file.getInputStream(); PDDocument pdfDoc =
PDDocument.load(in)) {
    PDFRenderer pdfRenderer = new PDFRenderer(pdfDoc);
    BufferedImage bim = pdfRenderer.renderImageWithDPI(0, 200,
ImageType.RGB);
}

I cannot share the source PDF since your mailing agent blocks me:
/ezmlm-reject: fatal: Sorry, I don't accept messages larger than
1000000 bytes (#5.2.3)/

however I attach some images describing the issue.

How can I share the PDF? Could you please provide me with some hints
on why this happens and if any possible workaround is applicable?

Thanks.
Marco


--




*
*

*Marco Barbi*
Ufficio TELLDA
Competence Leader



*
*

*Cell: *+39 3317478311





          Via A. Delfini 26

          41123 Modena (MO) - ITA

www.credemtel.it <https://www.credemtel.it/>











  meno carta... più alberi: se non è proprio necessario non stampare
questa mail, grazie.

------------------------------------------------------------------------

/Le informazioni contenute nella presente comunicazione e negli
eventuali documenti ad essa allegati potrebbero essere tutelate dal
segreto bancario e sono comunque confidenziali e ad uso esclusivo del
destinatario sopra indicato. Qualora non fossero a lei destinati, la
preghiamo di tener presente che la divulgazione, distribuzione o
riproduzione di qualunque informazione in essi contenuti sono vietate.
Se ha ricevuto la presente comunicazione per errore, la preghiamo di
volerci avvertire immediatamente e di distruggere quanto ricevuto. Con
il presente messaggio la scrivente societa' non intende contrarre
obbligazioni o svolgere attivita' di consulenza o di collocamento e
promozione di strumenti finanziari. //L'eventuale assunzione di
obbligazioni dovrà essere espressamente accettata dalla scrivente
società per iscritto o tramite un messaggio //che riporti una firma
digitale, così come definita dal D.Lgs. 7 marzo 2005, n. 82. //La
Società, inoltre, ha adottato un Modello ai sensi del D.Lgs. 231/01,
di cui Parte Generale e Codice Etico sono consultabili sul sito
www.credemtel.it <http://www.credemtel.it>./

/Grazie per la collaborazione./
/Credemtel S.p.A./

* * * *


/This message including any attachments contains confidential
information intended for a specific individual and purpose, and is
protected by law. If you are not the intended recipient, you are
hereby notified that any disclosure, copying, or distribution of this
message is strictly prohibited, and are kindly requested to return the
e-mail to sender and delete this message from your computer. By
sending this message, our company does not intend to enter into any
legally binding obligation or provide any financial advice or offer to
buy or sell financial instruments or make solicitation of such
products and services. //Our acceptance of legally binding obligation
must be confirmed by us either in writing or via e-mail with
chriptographically authenticated digital signature and certification
of message integrity (so called "firma digitale", in accordance to
Italian Decree 7 March 2005, no. 82). //Furthermore, the company has
adopted an Organisation, Management and Control Model pursuant to
Italian Legislative Decree no. 231/01. The General Part and the
Ethical Code of the Model can be viewed on the website
www.credemtel.it <http://www.credemtel.it>./

/Many thanks for your kind co-operation./

/Credemtel S.p.A./


---------------------------------------------------------------------
To unsubscribe,e-mail:users-unsubscr...@pdfbox.apache.org
For additional commands,e-mail:users-h...@pdfbox.apache.org

Reply via email to