Hello!
In our application we allow user to upload different files and then generate pdf file with all the uploaded file attached (very simplified).
While generating files I’m using PdfFileEditor and ResizeContents method to manually create “footer” so I can place there some information like page number, file name, etc.
This is my code:
var fileEditor = new PdfFileEditor();
var parameters = new PdfFileEditor.ContentsResizeParameters(
PdfFileEditor.ContentsResizeValue.Units(10),
null,
PdfFileEditor.ContentsResizeValue.Units(10),
PdfFileEditor.ContentsResizeValue.Units(10),
null,
PdfFileEditor.ContentsResizeValue.Units(40)
);
foreach (var doc in documentsInfo)
{
fileEditor.ResizeContents(doc.Value.Document, parameters);
}
For almost every file this works and I’m getting result similar to this:
But for one file it completely breaks the file, and I’m getting this result:
This happens for every page of this document, but only this document. Any other file (pdf, doc, image, anything) works brilliant.
Original page:
Am I doing something wrong or is it problem with this one document.
Nevertheless I need to make it work for every document.