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 Feb 24, 2016 3:59 pm

Hi,

I'm actually trying your library to convert an rtf doc to pdf.
I use the following code :

PdfDocument pdf = new PdfDocument();

PdfUnitConvertor unitCvtr = new PdfUnitConvertor();
PdfMargins margin = new PdfMargins();
margin.Top = unitCvtr.ConvertUnits(2.54f, PdfGraphicsUnit.Centimeter, PdfGraphicsUnit.Point);
margin.Bottom = margin.Top;
margin.Left = unitCvtr.ConvertUnits(3.17f, PdfGraphicsUnit.Centimeter, PdfGraphicsUnit.Point);
margin.Right = margin.Left;

PdfPageBase page = pdf.Pages.Add(PdfPageSize.A4, margin);
String rtf = System.IO.File.ReadAllText(input_rtf_file);
page.LoadFromRTF(rtf, page.Canvas.ClientSize.Width, true);
pdf.SaveToFile(output_pdf_file);

Conversion work, but pdf doesn't have header. You can find in attachment the rtf input file.
Thanks for your help.

Thomas

tburnet
 
Posts: 1
Joined: Wed Feb 24, 2016 2:25 pm

Thu Feb 25, 2016 3:57 am

Hi,

Thanks for your posting and using our component.
Please use our Spire.Doc component to convert your RTF to PDF and it will get a good output.
At present the latest version is Spire.Doc Pack(hot fix) Version:5.6.27, please test it.
Sample code:
Code: Select all
var doc = new Spire.Doc.Document(@"..\\..\\892.rtf");
            doc.SaveToFile(@"..\\..\\Output\\6982.pdf", FileFormat.PDF);


Best Regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 3043
Joined: Wed Jun 27, 2012 8:50 am

Tue Mar 01, 2016 7:59 am

Hi,

Did Spire.Doc component resolve your issue?
Thanks for your feedback.

Best Regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 3043
Joined: Wed Jun 27, 2012 8:50 am

Return to Spire.PDF