Nadsy:Good afternoon,I just wanted to add that I’m following this thread (albeit for the .NET version). We have a situation where a Word document is on an A4 papersize, but the margins are setup like a B5 (T:70.9, R:120.5, B:212.65, L:120.5), and we need to detect these margins in the generated PDF.I have tried several suggestions in the forum (such as using PageSettings (Words) before Saving to PDF and using PdfFileEditor (PDF) on the generated PDF), but none seem to work. The margins always come out as 72,90,72,90 if the papersize is A4. The only way I was able to detect different margins was if I distilled the PDF (using Acrobat) first.Are you able to provide a workaround sample for my scenario whilst we wait for a fix for the above?I am using version 126.96.36.199 of both Aspose.Words and Aspose.Pdf (.NET).Hi Nadaav,Thanks for contacting support.The issue reported in this thread is related to Aspose.Pdf for Java whereas you are facing problem while using Aspose.Pdf for .NET. Furthermore, we request you to please share your input files, so that we can test the scenario in our environment. We are sorry for your inconvenience.
Document document = new Document(dataDir + “AsposeTestWord.pdf”);<o:p></o:p>
document.Pages.PageInfo.Margin.Top = 144;
document.Pages.PageInfo.Margin.Bottom = 144;
document.Pages.PageInfo.Margin.Right = 100;
document.Pages.PageInfo.Margin.Left = 100;
Therefore I have logged this issue as PDFNET-42376 in our issue tracking system for the sake of detailed investigation. We will further look into the details of this issue and keep you updated on the status of its resolution. Please be patient and spare us a little time. We are sorry for the inconvenience.
Nadsy:is there a way of tracking progress of a job with the job number you provided?
Is there any update on PDFJAVA-36496
Thanks for your inquiry.
After further investigating earlier logged issue we have found it as not a bug in the API. Please note that
PageInfo properties are used for PDF generation only (for convenience of API users). PDF format has not page margin as entity but for existing document, you can try to calculate what you need, by analysis such entities as
Please, get more information and code snippets here: https://docs.aspose.com/display/pdfjava/Get+and+Set+Page+Properties
Attach is the pdf document but I am not sure how to calculate the margins since the values are same for the box objects.
ArtBox : Height = 832.0, Width = 682.0, LLX = 0.0, LLY = 0.0, URX = 682.0, URY = 832.0
BleedBox : Height = 832.0, Width = 682.0, LLX = 0.0, LLY = 0.0, URX = 682.0, URY = 832.0
CropBox : Height = 832.0, Width = 682.0, LLX = 0.0, LLY = 0.0, URX = 682.0, URY = 832.0
MediaBox : Height = 832.0, Width = 682.0, LLX = 0.0, LLY = 0.0, URX = 682.0, URY = 832.0
TrimBox : Height = 832.0, Width = 682.0, LLX = 0.0, LLY = 0.0, URX = 682.0, URY = 832.0
Rect : Height = 832.0, Width = 682.0, LLX = 0.0, LLY = 0.0, URX = 682.0, URY = 832.0
Thanks for sharing your feedback.
We have logged an investigation ticket as PDFJAVA-38023 to investigate scenario with your shared PDFs. As soon as we make some significant progress towards resolution of the ticket, we will surely share with you. Please spare us little time.
We are sorry for the inconvenience.
We have investigated the logged ticket and found that for this particular document the
ContentBBox could be used. It returns the rectangle containing contents without visible margins.
Rectangle contentBox = pdfPage.calculateContentBBox(); System.out.println("LLX = " + contentBox.getLLX() + ", LLY = " + contentBox.getLLY() + ", URX = " + contentBox.getURX() + ", URY = " + contentBox.getURY()); System.out.println("left = " + (contentBox.getLLX() - pdfPage.getRect().getLLX()) + ", bottom = " + (contentBox.getLLY() -pdfPage.getRect().getLLY()) + ", right = " + (pdfPage.getRect().getURX() - contentBox.getURX()) + ", top = " + (pdfPage.getRect().getURY() - contentBox.getURY()));