Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Wed May 24, 2017 9:21 pm

Hi Everyone,

My small ASP.NET MVC web application creates a small PDF file and prints on a Label printer.
Could someone help me with how I can create a PDF file with custom page size (ex. 3.5mm x 24mm).

As an example,
Code: Select all
Spire.Pdf.PdfDocument doc = new PdfDocument();
PdfPageBase page = doc.Pages.Add(PdfPageSize.A4, new PdfMargins(0));

Maybe if I can create a custom PdfPageSize. I might be able to use that instead of PdfPageSize.A4.
Any help appreciated. Thanks

tonmoy
 
Posts: 2
Joined: Fri May 12, 2017 12:18 am

Thu May 25, 2017 2:05 am

Dear tonmoy,

Thanks for your inquiry.
Here is sample code for your kind reference.
Code: Select all
            //custom size
            SizeF size = new SizeF(100,100);           
            doc.Pages.Add(size, new Spire.Pdf.Graphics.PdfMargins(0));

If there is still issue, please let me know.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Thu May 25, 2017 4:35 am

Hi Betsy,

First of all, thank you very much for your reply.

I actually have already figured that out by going to the Definition of SizeF struct.

Anyway, I also have read some more question/answer(s) on this forum. Spire.PDF is very cool. And trust me, you people are awesome with your support too. This helps a lot for the new developers like me. Hats off.


Kind Regards,
Tonmoy

tonmoy
 
Posts: 2
Joined: Fri May 12, 2017 12:18 am

Thu May 25, 2017 5:40 am

Dear Tonmoy,

Thanks for your feedback.
Please feel free to contact us if you have any question. We are here for help :) .

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Return to Spire.PDF

cron