0

We need to generate PDF from HTML with ABCPDF, letting 3 mm bleedbox on every side of the document. So that after printing there is enough room for cutting the edges of the page and bind a book from the printed pages.

I have tried below code with some variations.

I am not able to get exact documentation (I doubt it exists). The nearest documentation is here.

I wonder if someone has done this or can guide in the right direction.

Here's the code snippet to start with.

using WebSupergoo.ABCpdf8;

namespace BleedBoxDemo
{
    class Program
    {
        static void Main(string[] args)
        { 
            string filePath = @"c:\myhtmldocument.html";

            if (System.IO.File.Exists(filePath))
            {
                string content = System.IO.File.ReadAllText(filePath);

                Doc theDoc = new Doc();

                theDoc.MediaBox.String = "A4";
                theDoc.Page = theDoc.AddPage();

                theDoc.SetInfo(theDoc.Page, "/BleedBox:Rect", "20 20 180 280");

                //for (int i = 1; i <= 2; i++)
                //{
                //    theDoc.FrameRect();
                //    theDoc.Rect.Inset(20, 20);
                //}

                //theDoc.Save(@"C:\mypdfdocument.PDF");
                //theDoc.Clear();

                theDoc.AddHtml(content);
                theDoc.Rect.String = "0 0 612 792";
                theDoc.FrameRect();
                theDoc.Rect.Inset(20, 20);
                theDoc.Save(@"C:\mydocumentwithbleedbox.PDF");
                theDoc.Clear();
            }
        }
    }
}
Devraj Gadhavi
  • 3,541
  • 3
  • 38
  • 67
  • can you not just modify the margins within th CSS directly? – Takarii Feb 11 '16 at 09:08
  • 1
    @Takarii, yes, but there would be a lot of html pages to be converted to PDF. We don't have the control on the html. We, would just get the path of the html and we need to convert it to html using our utility (read: console) application. – Devraj Gadhavi Feb 11 '16 at 09:12

0 Answers0