prbcover-gn-PB-personalized.pdf (334.7 KB)
prbcover-output-gn-PB-personalized.pdf (357.9 KB)
I can not set the TRIM BOX with Aspose.PDF. In addition, The FloatingBox seems to be offset about an inch down and right even though I set the top =1 and left = 1. …Any ideas on why the Trim Box setting will not save and why the FloatingBOx box is moved down and right. The Code is listed below.
public void AssemblePressSheet()
{
Document doc = new Document( inputFile);
Page page = doc.Pages[1];
SetTrimBox( doc, page );
ShowInfo( doc );
doc.Save(outputFile);
}
public void SetTrimBox( Document doc, Page page)
{
page.TrimBox.LLX = 292; // (left Side) points from left side of pdf
page.TrimBox.LLY = 144; // (bottom) points from bottom of pdf
page.TrimBox.URX = 904; // (right side) points from left side of pdf
page.TrimBox.URY = 650; // (top) points from bottom side of pdf
}
public void ShowInfo(Document doc)
{
Page page = doc.Pages[1];
FloatingBox box = new Aspose.Pdf.FloatingBox();
box.Top = 1;
box.Left = 1;
box.Height = 100;
box.Width = 160;
box.BackgroundColor = Aspose.Pdf.Color.FromRgb(System.Drawing.ColorTranslator.FromHtml("#FFFFFF"));
box.HorizontalAlignment = HorizontalAlignment.Left;
box.VerticalAlignment = VerticalAlignment.Top;
box.ZIndex = 10;
box.Border = new BorderInfo(BorderSide.Box);
string LLX = page.TrimBox.LLX.ToString(); // (left Side) points from left side of pdf
string LLY = page.TrimBox.LLY.ToString(); // (bottom) points from bottom of pdf
string URX = page.TrimBox.URX.ToString(); // (right side) points from left side of pdf
string URY = page.TrimBox.URY.ToString(); // (top0) points from bottom side of pdf
TextFragment fragment = new Aspose.Pdf.Text.TextFragment(
"Trim Box " + Environment.NewLine +
"LLX = " + LLX + Environment.NewLine +
"LLY= " + LLY + "\nURX = " + URX + "\nURY = " + URY );
fragment.TextState.Font = FontRepository.FindFont("TimesNewRoman");
fragment.TextState.FontSize = 8;
fragment.TextState.ForegroundColor = Aspose.Pdf.Color.FromRgb(System.Drawing.ColorTranslator.FromHtml("#000000"));
box.Paragraphs.Add(fragment);
page.Paragraphs.Add(box);
}