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

Notification

Icon
Error

Options
Go to last post Go to first unread
rhnatiuk  
#1 Posted : Wednesday, June 5, 2019 3:42:18 AM(UTC)
rhnatiuk

Rank: Advanced Member

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

Thanks: 9 times
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 12:10:30 PM(UTC)
Paul Rayman

Rank: Administration

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

Thanks: 1 times
Was thanked: 98 time(s) in 96 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 5:56:14 AM(UTC)
rhnatiuk

Rank: Advanced Member

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

Thanks: 9 times
Thank you!
Users browsing this topic
Forum Jump  
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.