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!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - Remove white spaces
  FAQ FAQ  Forum Search   Register Register  Login Login

Remove white spaces

 Post Reply Post Reply
Author
Message
kk aw View Drop Down
Team Player
Team Player
Avatar

Joined: 02 Feb 10
Location: Malaysia
Status: Offline
Points: 36
Post Options Post Options   Thanks (0) Thanks(0)   Quote kk aw Quote  Post ReplyReply Direct Link To This Post Topic: Remove white spaces
    Posted: 01 Dec 13 at 12:19PM
Is it possible to remove the white spaces (along the borders) of the PDF document using the QuickPDF library?
Back to Top
AndrewC View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 08 Dec 10
Location: Geelong, Aust
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post Posted: 03 Dec 13 at 6:22AM
kk,

You could always adjust the CropBox and make it smaller.  Technically it doesn't remove any content from the PDF file but it adjusts the visiblee rectangle that is used for displaying the PDF in Acrobat and other viewers.

This would assume you know how big the borders are in the first place.  Depending on the PDF there could be ways to determine this programmatically.

  QP.LoadFromFile ....
  QP.SetPageBox(2, left, top, width, height);  // 2 = CropBox.
  QP.SaveToFile ..

Andrew.
Back to Top
kk aw View Drop Down
Team Player
Team Player
Avatar

Joined: 02 Feb 10
Location: Malaysia
Status: Offline
Points: 36
Post Options Post Options   Thanks (0) Thanks(0)   Quote kk aw Quote  Post ReplyReply Direct Link To This Post Posted: 03 Dec 13 at 10:32AM
Andrew,

Thanks for the response.  I need to determine this programmatically.  How would I do that?

KK Aw
Back to Top
AndrewC View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 08 Dec 10
Location: Geelong, Aust
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post Posted: 04 Dec 13 at 8:05AM
kk,

There is no simple solution as it depends on your PDF file.

One option would be to call QP.RenderPageToFile with a low DPI value to a Bitmap and then use code to read the pixels line by line searching for the 1st non white pixel.  You would need to search from 4 different directions to detect the top, left, right and bottom margins.  You then convert this pixel position back to points.  If you render at 72dpi then pixels = points.

Andrew.

Back to Top
kk aw View Drop Down
Team Player
Team Player
Avatar

Joined: 02 Feb 10
Location: Malaysia
Status: Offline
Points: 36
Post Options Post Options   Thanks (0) Thanks(0)   Quote kk aw Quote  Post ReplyReply Direct Link To This Post Posted: 04 Dec 13 at 10:39AM
Thanks.  
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store