cart: empty [ Login ]

Exported PDF error in Acrobat Reader

1 
McGum
5/9/2018 12:08 PM
Hi Wout, if I export a Layout (use A0) to PDF, then Adobe shows a error message. Its not related to the enabled layer (Stempelfeld is always on..) See atteched DWG
Wout
5/9/2018 12:18 PM
Hi, I also need the code you use to create the PDF, there are a number of parameters that can affect the output PDF (like font embedding etc). - Wout
McGum
5/9/2018 12:23 PM
here you are
C# Code:
public static byte[] ExportModelToPdfByte(Matrix4D transform, DxfModel model, PaperSize paperSize, List<DxfLayout> layout = null, double scale = 1) { var graphicsConfig = (GraphicsConfig)GraphicsConfig.WhiteBackgroundCorrectForBackColor.Clone(); graphicsConfig.TryDrawingTextAsText = true; // Apparently all lines have line weight 0, so they were invisible. // With this setting the line weight is ignored. graphicsConfig.DisplayLineWeight = true; graphicsConfig.DefaultLineWeight = 0; using (var ms = new MemoryStream()) { //create the pdf container with the empty stream var pdf = new PdfExporter(ms) { ExportLayers = true, EmbedFonts = true }; //draw the model into the pdf containers stream if (layout == null && model.Layouts.Count > 2) pdf.DrawPage(model, graphicsConfig, transform, scale, model.Layouts[2], model.Layouts[2].Viewports, paperSize); else if (layout != null) { foreach (var dxfLayout in layout) { pdf.DrawPage(model, graphicsConfig, transform, scale, dxfLayout, dxfLayout.Viewports, paperSize); } } else { graphicsConfig.DisplayLineWeight = false; pdf.DrawPage(model, graphicsConfig, transform, paperSize); } //create the pdf pdf.EndDocument(); byte[] buffer = ms.ToArray(); return buffer; } }
McGum
5/9/2018 1:17 PM
found a new Issue/information .. on debugging session it works fine but on the server -> we get the wrong pdf ...
Wout
5/9/2018 1:27 PM
I'm not able to reproduce it, but since you didn't provide complete code I could be calling your method differently than you. - Wout
McGum
5/9/2018 1:31 PM
Yes - as we can't reproduce this local to, we are trying to figuare out, whats the different between local and server call
Wout
5/9/2018 1:34 PM
Possibly the absence or presence of a particular font. It's not easy to tell what it is. You could set PdfExporter.PackContent to false in both debug/server, which makes inspecting the produced PDF files easier as they're then not compressed. - Wout
McGum
5/9/2018 2:02 PM
OK, after windows update it works fine :) Sorry for wasting your time with this issue :(
Wout
5/9/2018 2:21 PM
Ok, super! - Wout
1