logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

New Topic Post Reply
Options
Go to last post Go to first unread
rhnatiuk  
#1 Posted : Wednesday, June 5, 2019 12:42:18 AM(UTC)
Quote
rhnatiuk

Rank: Advanced Member

Groups: Registered
Joined: 4/30/2019(UTC)
Posts: 48
Man
Finland
Location: Raisio

Thanks: 11 times
Was thanked: 3 time(s) in 2 post(s)
Hi,

I am able to resize a PDF page using its MediaBox, and the saved PDF file looks good.

The problem is, that when I am resizing the PdfPage using the MediaBox approach, the Width and the Height properties of the page are not reflecting the change, and there seems to be no way to tell the page that it needs to synchronize its reported size with the updated MediaBox.

The only way to "fix" it seems to be calling pdfPage.Dispose(). This is solving the problem of the reported page size but feels very wrong, as it violates the Dispose() semantics.

After calling Dispose(), the pdfPage is remaining "alive", and all its properties are accessible and contain correct data. It is like if the page is resurrected upon first property request (or, it was never disposed in the first place?)

So, the question is: is there any correct way to "refresh" the pdfPage metadata in case of resizing?

Thank you in advance for your answer!
Paul Rayman  
#2 Posted : Thursday, June 6, 2019 9:10:30 AM(UTC)
Quote
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 1,138

Thanks: 10 times
Was thanked: 133 time(s) in 130 post(s)
Hi,

In order to reflect the changes, the page must be reloaded. The architecture of the engine is such that the pages of the document are not loaded all at once when the document is opened, but loaded as needed. When you call page.Dispose(), the page is realy unloaded and all resources are disposed, however, if the page is visible in the viewer, or you programmatically try to get access to any property or call any method, the page will be immediately loaded.
Therefore, calling the Dispose() method is, from the SDK point of view, the correct way to reload the page.
thanks 1 user thanked Paul Rayman for this useful post.
rhnatiuk on 6/7/2019(UTC)
rhnatiuk  
#3 Posted : Friday, June 7, 2019 2:56:14 AM(UTC)
Quote
rhnatiuk

Rank: Advanced Member

Groups: Registered
Joined: 4/30/2019(UTC)
Posts: 48
Man
Finland
Location: Raisio

Thanks: 11 times
Was thanked: 3 time(s) in 2 post(s)
Thank you!
Quick Reply Show Quick Reply
Users browsing this topic
Guest
New Topic Post Reply
Forum Jump  
You can post new topics in this forum.
You can reply to topics in this forum.
You can delete your posts in this forum.
You can edit your posts in this forum.
You cannot create polls in this forum.
You can vote in polls in this forum.