Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!
How to get the bounds of the visible page contents |
Post Reply |
Author | ||
Z3R0
Beginner Joined: 14 Mar 19 Status: Offline Points: 3 |
Post Options
Thanks(0)
Posted: 07 Nov 19 at 4:33PM |
|
Hello, for our product we're using the Debenu PDF Library Version 13.12 with Delphi source code. We have implemented a viewer to render PDF files and some predefined zoom factor values (fit width, whole page, etc.) based on the page bounds. We now want to implement functionality like "fit visible", as known from other pdf viewer software. I read about a BBox value at some adobe related site, but it seems to be a calculated value only. In the library reference i found some functions for TextBlocks, which I use to walk over all TextBlocks of the current page, get their bounds and calculate the min and max values to create a rectangle with this information. A draw test has been completed successfully. But this may consume a lot of performance depending on the count of TextBlocks. Especially if I have to handle images the same way. Is there a way to get the needed information by the library directly? Thanks in advance.
|
||
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
|
Hi Zero,
perhaps (because i don't use the function by myself) GetPageContentToString could feed your needs? https://www.debenu.com/docs/pdf_library_reference/GetPageContentToString.php The best start for unanswered questions is the central search here: https://www.debenu.com/docs/pdf_library_reference/Search.php Cheers and welcome here, Ingo Edited by Ingo - 07 Nov 19 at 10:11PM |
||
Cheers,
Ingo |
||
Z3R0
Beginner Joined: 14 Mar 19 Status: Offline Points: 3 |
Post Options
Thanks(0)
|
|
Hello Ingo, thanks for your reply. I looked at the suggested function and tested its output. Like the name says, it returns the raw pdf data for the selected content stream, so it have to be parsed completely. This will need a complete pdf parser. A cropped example output for a content stream via GetContentStreamToString:
Another solution could not be found within the reference. So I think we have to use TextBlock-functions to get the needed information. For example GetTextBlockBound returns the bounding boxes for any text element, so min and max values can be calculated over all the bound values of the whole text content for a page. Example output of my test function for a single text element via GetTextBlockBound:
We will process the other possible visible elements like images or form fields the same way and calculate the visible area over all the content bounds. I hoped for a simpler solution approach. Thanks anyway.
|
||
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions 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 |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store