Hi, when converting rtf to pdf , Frames are not being converted correctly and the borders are not appearing in the PDF. Any solution to this?
Thanks,
Darren.
Hi, when converting rtf to pdf , Frames are not being converted correctly and the borders are not appearing in the PDF. Any solution to this?
Thanks,
Darren.
Thanks for your inquiry. Please ZIP and attach your input Word document here for testing. We will investigate the issue on our side and provide you more information.
Thanks for sharing the document. We have tested the scenario using following code example and have not found the shared issue. Please check the attached output PDF. 18.4.pdf (42.8 KB)
Could you please share the code that you are using to reproduce this issue? Thank for your cooperation.
Document doc = new Document(MyDir + "RTFTOPDF.RTF");
PdfSaveOptions options = new PdfSaveOptions();
options.Compliance = PdfCompliance.PdfA1a;
doc.Save(MyDir + "18.4.pdf", options);
using (MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(rtf)))
{
Document doc = new Document(stream);
PdfSaveOptions pdfSaveOptions = new PdfSaveOptions
{
SaveFormat = SaveFormat.Pdf
};
using (MemoryStream streamText = new MemoryStream())
{
// save will convert to a pdf
doc.Save(streamText, pdfSaveOptions);
doc.Save(@"c:\\temp\\pdfdoc.pdf", pdfSaveOptions);
return streamText.ToArray();
}
}
here’s a code snippet taken from a functions that passes in a string which is the rtf , and returns a byte array
Thanks,
Darren.
rtftopdf2.pdf (42.7 KB)
after applying the PdfA1a compliance i re-tested and still got the same issue.
Please see attached file.
Darren.
Ive noticed that is the rtf is loaded into a memorystream and that the memorystream is used to create the document then when the document is saved the frames borders disappear. work fine if you explicitely use a path to the rtf
Cheers,
Darren.
Thanks for your inquiry. We have tested the scenario using following code example and have not found the shared issue. Please make sure that you are using the same RTF and code example.
using (MemoryStream stream = new MemoryStream(File.ReadAllBytes(MyDir + "RTFTOPDF.RTF")))
{
Document doc = new Document(stream);
PdfSaveOptions pdfSaveOptions = new PdfSaveOptions
{
SaveFormat = SaveFormat.Pdf, Compliance = PdfCompliance.PdfA1a
};
using (MemoryStream streamText = new MemoryStream())
{
// save will convert to a pdf
doc.Save(streamText, pdfSaveOptions);
streamText.Position = 0;
using (FileStream fs = new FileStream(MyDir + "18.4.pdf", FileMode.OpenOrCreate))
{
streamText.CopyTo(fs);
fs.Flush();
}
}
}