Block text on non-plot layer is printed in pdf

1
Bogdan Eremia
1/30/2019 6:59 PM

Hello,

Is seems like text set on a layer that is set to not plot is visible when creating pdf.
Please see attached dwg and code below. In the dwg I also added a normal text (not in a block) that one is not visible in the pdf.
Please have a look and let me know.

C# Code:
string exldDwg = Path.Combine(folder, "Test.DWG");
DxfModel model = DwgReader.Read(exldDwg);
var layout = model.Layouts["ESPrintPareLayout"];

BoundsCalculator boundsCalculator = new BoundsCalculator();
boundsCalculator.GetBounds(model, layout);
Bounds3D bounds = boundsCalculator.Bounds;
//PaperSize paperSize = PaperSizes.GetPaperSize(ppKnd);
// Lengths in inches.
float pageWidth = (float)paperSize.Width / 100f;
float pageHeight = (float)paperSize.Height / 100f;
float margin = 0.0f;

double scaling;
Matrix4D to2DTransform = DxfUtil.GetScaleTransform(
    bounds.Corner1,
    bounds.Corner2,
    new Point3D(bounds.Center.X, bounds.Corner2.Y, 0d),
    new Point3D(new Vector3D(margin, margin, 0d) * PdfExporter.InchToPixel),
    new Point3D(new Vector3D(pageWidth - margin, pageHeight - margin, 0d) * PdfExporter.InchToPixel),
    new Point3D(new Vector3D(pageWidth / 2d, pageHeight - margin, 0d) * PdfExporter.InchToPixel),
    out scaling);

using (Stream stream = File.Create(Path.Combine(folder, "1.PDF")))
{
    GraphicsConfig grfCnfg = GraphicsConfig.AcadLikeWithWhiteBackground.Clone() as GraphicsConfig;
    grfCnfg.DefaultLineWeight = 1;
    grfCnfg.ApplyLineType = true;
    grfCnfg.TryDrawingTextAsText = true;
    grfCnfg.DrawImages = true;
    grfCnfg.DisplayLineTypeElementShapes = true;

    PdfExporter pdfGraphics = new PdfExporter(stream);
    pdfGraphics.ExportLayers = true;
    pdfGraphics.UseMultipleLayers = true;
    pdfGraphics.EmbedFonts = true;


    pdfGraphics.DrawPage(
        model,
        grfCnfg,
        to2DTransform,
        scaling,
        layout,
        layout.Viewports,
        paperSize);
    pdfGraphics.EndDocument();
}
model.Dispose();

Wout
1/31/2019 3:08 PM

Hi,

You have to explicitly set GraphicsConfig.Plot to true for this situation:

C# Code:
                grfCnfg.Plot = true;

- Wout

Bogdan Eremia
1/31/2019 3:12 PM

Thank you, that did the job.

1