Is there a way to ‘flatten’ the pdf, on generation, so it doesnt have to ‘flatten’ when printed?
thanks
Can you please explain your requirements in detail along with source file, generated output and desired output. As far as API is concerned, when we render the DWG/DXF, we don’t render layer by layer rendering and in fact render flat output PDF.
when an end user attempts to print a pdf (viewed in ‘Acrobat Reader DC’ ) created with your plug-in, a pop-up appears, with a status meter, and there is a delay while the image is ‘flattened’
Please share a working example, source file, generated PDF, Adobe version and snapshot of issue incurring so that we may observe the issue further on our end.
there is a delay, in printing, of between 3-10 seconds, while image is flattened (the attached png is a print dialog snapshot, showing the meter that pops up as it is being flattened), the text file contains the c# code, and the included .pdf file is the generated output.
Any help with this would be appreciated
81000D-1.pdf (568.1 KB)
flattening-pdf.png (278.5 KB)
sorry, the text file did not upload
here is the c# code
sourceFilePath = “c:\drawings\81000D-1.dwg”
destinationFilePath = “c:\DrawingPdfs\81000D-1.pdf”
private void ConvertDwgToPdfWithOptions(string sourceFilePath, string destinationFilePath)
{
var stream = new MemoryStream(Resources.Aspose_CAD_NET);
var license = new License();
license.SetLicense(stream);
using (Aspose.CAD.FileFormats.Cad.CadImage cadImage = (Aspose.CAD.FileFormats.Cad.CadImage)Image.Load(sourceFilePath))
{
// Iterate over the items of CadStyleDictionary
foreach (CadStyleTableObject style in cadImage.Styles)
{
// Set the font
style.PrimaryFontName = "ISOCP";// "Arial";
}
char firstCharacter = Path.GetFileName(sourceFilePath)[0];
//The first digit of the drawing number dictates the page size, all drawings are 'landscape'
//11 x 8.5 => [1,2,3]
//17 x 11 => [4,5]
//22 x 17 => [6,7]
//34 x 22 => [8,9]
float pageWidth = (firstCharacter.Equals('8') || firstCharacter.Equals('9')) ? 34f
: (firstCharacter.Equals('6') || firstCharacter.Equals('7')) ? 22f
: (firstCharacter.Equals('4') || firstCharacter.Equals('5')) ? 17f
: 11f;
float pageHeight = (firstCharacter.Equals('8') || firstCharacter.Equals('9')) ? 22f
: (firstCharacter.Equals('6') || firstCharacter.Equals('7')) ? 17f
: (firstCharacter.Equals('4') || firstCharacter.Equals('5')) ? 11f
: 8.5f;
var rasterizationOptions = new CadRasterizationOptions
{
BackgroundColor = Color.White,
PageWidth = pageWidth,
PageHeight = pageHeight,
Margins = new Margins { Bottom = 36, Left = 36, Top = 36, Right = 36 },
UnitType = UnitType.Inch
};
var pdfOptions = new PdfOptions
{
VectorRasterizationOptions = rasterizationOptions
};
//Export the DWG to PDF
cadImage.Save(destinationFilePath, pdfOptions);
}
}
how do we share the dwg? I cannot attach it here, I get the following message
‘Sorry, the file you are trying to upload is not authorized (authorized extensions: jpg, jpeg, png, gif, zip, pdf).’
Thank you for sharing the file. We are working over the shared file and will get back to you with feedback as soon as possible.
I have created an investigation ticket with ID CADNET-1341 on our end to further evaluate whether the output generated is flat or not. I have already shared that Aspose.CAD for .NET render flat PDF but we will investigate the information shared by you and will get back to you with feedback as soon as it will be shared.