Welcome Guest Search | Active Topics | Sign In | Register

PdfDocument.Info.Title incorrectly set, when PdfDocumentPermissions used Options
Andreea
Posted: Thursday, April 26, 2018 9:01:46 AM
Rank: Newbie
Groups: Member

Joined: 1/17/2018
Posts: 5
Hi,

I have a problem with the PdfDocument.Info.Title of the pdf document, when setting PdfDocumentPermissions.

I have something like this:
var result = pdfDocs.Count > 0 ? PdfDocument.Merge(pdfDocs.ToArray()) : new PdfDocument();
Stream output;

The result is a pdf with pages and bookmarks both using the text 'title1' in some way or the other.

I save the PdfDocument to a stream, but just before saving it i set permissions like this:

result.Security.Disallow(
PdfDocumentPermissions.ModifyingContents |
PdfDocumentPermissions.FillingFormFields |
PdfDocumentPermissions.Commenting);

result.Save(output);

At this point the result has the Info.Title set to "Binder"(correct).

If I take the stream created and do this:
var pdf = new PdfDocument(stream);
The Info.Title is still "Binder" (correct)

But if I try to write this stream containing the pdf to the disk, doing something like this:

string filePath = System.IO.Path.GetTempPath() + Guid.NewGuid().ToString() + ".pdf";

using (var fileStream = File.Create(filePath))
{
inputStream.Seek(0, SeekOrigin.Begin);
inputStream.CopyTo(fileStream);
}

When I try to load the pdf that was written to disk I can see the title being set correctly.
However other pdf libraries pick up "title1" instead of "Binder".

Opened the file in Adobe Acrobat Reader DC, and see the properties of the document, the title is wrong.

The wrong title is the title of the first document that was merged into the pdf.


I have to mention that without the permissions added, the title is set correctly.

Thank you!
eo_support
Posted: Thursday, April 26, 2018 4:27:37 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,221
Hi,

Can you create a test application and then send the test application to us so that we can investigate further? See here for more information on how to send test application to us:

https://www.essentialobjects.com/forum/test_project.aspx

Make sure you include the files that you are trying to merge.

Thanks!
eo_support
Posted: Friday, May 4, 2018 10:03:36 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,221
Hi,

We have looked into the test project you sent to us. The issue you observed seems to be a bug in Acrobat Reader. Below are our findings:

1. The issue is triggered when the document is encrypted (setting document permission automatically encrypt the document). When the document is encrypted, the title value in the PDF file is encrypted as well. It appears that Adobe Reader is not able to read encrypted title value thus defaults to "title1";

2. The issue is unrelated to Document.Merge;

3. If you try to open the encrypted PDF file with other PDFViewers (we specifically tested the built-in PDFViewer in Chrome and FireFox. IE demonstrates the same problem because it uses Adobe Reader plugin), they will show title as "Binder" correctly. So can our library read this value correctly;

Hope this helps. Please feel free to let us know if you have any more questions.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.