简体   繁体   English

PDFClown无法编辑创建的PDF

[英]PDFClown cannot edit created PDF

I'm using PDF Clown (in C#) to generate a PDF file containing graphics (lines, polygons and circles) on separate layers. 我正在使用PDF Clown(在C#中)生成一个PDF文件,该文件在单独的图层上包含图形(线,多边形和圆形)。 Now I run into a problem and I have searched the internet for days but cannot find the solution. 现在我遇到了问题,已经在互联网上搜索了几天,但找不到解决方案。

I have the following problem: How can I make sure that the PDF generated by PDFClown can be edited/modified using another application like for instance Blue Beam or Adobe Acrobat? 我有以下问题:如何确保可以使用Blue Beam或Adobe Acrobat等其他应用程序编辑/修改PDFClown生成的PDF? At this moment the generated PDF looks ok but I'm unable to select and modify any of the graphics (lines, polygons etc.) on any layer. 目前,生成的PDF看起来还不错,但是我无法选择和修改任何层上的任何图形(线,多边形等)。

Should I set something during creating layers or graphic objects? 在创建图层或图形对象时是否应该设置一些内容?

A link to the generated file: https://drive.google.com/open?id=1om4UByGhfS1D9OOCYzhHrNjNQeNcJI-0 生成文件的链接: https : //drive.google.com/open?id=1om4UByGhfS1D9OOCYzhHrNjNQeNcJI-0

I would really appreciate your help! 我将衷心感谢您的帮助! Following is piece of the code where a polyline is created. 以下是创建折线的代码段。

var pdfFile = new File();

m_PdfDocument = pdfFile.Document;
m_PdfDocument.PageSize = PageFormat.GetSize(PageFormat.SizeEnum.A4);
m_PdfDocument.Version = Version.Get("1.6");


m_PdfPage = new Page(m_PdfDocument);
m_PdfDocument.Pages.Add(m_PdfPage);

var primitiveComposer = new PrimitiveComposer(m_PdfPage);

primitiveComposer.SetLineJoin(LineJoinEnum.Miter);
primitiveComposer.SetLineCap(LineCapEnum.Square);
primitiveComposer.SetLineWidth(2);

primitiveComposer.SetStrokeColor(DeviceRGBColor.Get(System.Drawing.Color.Black))
// Flip Y axis!
primitiveComposer.SetMatrix(1, 0, 0, -1, 0, m_PdfPage.Size.Height);

primitiveComposer.BeginLayer(layer);
primitiveComposer.DrawPolyline(line.ToArray());
primitiveComposer.Stroke();
primitiveComposer.End();

primitiveComposer.Flush();

pdfFile.Save(filename, SerializationModeEnum.Standard);

Edit2: New test file https://drive.google.com/open?id=1PHACkr2EcWrdIP5XocCnwDtakQ-P0hJY Edit2:新的测试文件https://drive.google.com/open?id=1PHACkr2EcWrdIP5XocCnwDtakQ-P0hJY

Edit 18-01-2019 In Bluebeam Revu a polyline entry looks like this: 编辑18-01-2019在Bluebeam Revu中,一条折线条目如下所示:

%PDF-1.5
%Çì¢
1 0 obj<</CreationDate(D:20190111132455+01'00')/ModDate(D:20190111132818+01'00')/Aut
hor(e.debont)/Creator(Bluebeam Revu x64)/Producer(Bluebeam PDF Library 18)>>
endobj
2 0 obj<</Type/Catalog/Pages 3 0 R/OCProperties 7 0 R>>
endobj
3 0 obj<</Type/Pages/Kids[4 0 R]/Count 1>>
endobj
4 0 obj<</Type/Pages/Kids[5 0 R]/Count 1/Parent 3 0 R>>
endobj
5 0 obj<</Type/Page/Parent 4 0 R/MediaBox[0 0 594.72 841.68]/Annots 19 0 R>>
endobj
6 0 obj<</Order[8 0 R]>>
endobj
7 0 obj<</OCGs[8 0 R]/D 6 0 R>>
endobj
8 0 obj<</Type/OCG/Name(Test)>>
endobj
19 0 obj[21 0 R]
endobj
21 0 obj<</Subj(Polylijn)/Type/Annot/P 5 0 R/F 4/C[1 0 0]/CreationDate
(D:20190111132642+01'00')/T(e.debont)/Subtype/PolyLine/AP<</N
22 0 R>>/IC[1 0 0]/M(D:20190111132642+01'00')/Vertices[225.8323 629.0071 
273.3759 657.8729 354.8793 583.5859]/Rect[220.3323 578.0859 360.3793 
663.3729]/NM(MQJCWGUIXHEAEWJU)/OC 8 0 R>>
endobj
22 0 obj<</Type/XObject/Subtype/Form/FormType 1/BBox[220.3323 578.0859 
360.3793 663.3729]/Resources<</ProcSet[/PDF]>>/Matrix[1 0 0 1 -220.3323 
-578.0859]/Length 84>>
stream
1 0 0 RG 1 0 0 rg 1 w 225.8323 629.0071 m 273.3759 657.8729 l 354.8793 
583.5859 l S 
endstream
endobj
xref
0 23
0000000000 65535 f 
0000000015 00000 n 
0000000183 00000 n 
0000000246 00000 n 
0000000296 00000 n 
0000000359 00000 n 
0000000443 00000 n 
0000000475 00000 n 
0000000514 00000 n 
0000000000 65535 f 
0000000000 65535 f 
0000000000 65535 f 
0000000000 65535 f 
0000000000 65535 f 
0000000000 65535 f 
0000000000 65535 f 
0000000000 65535 f 
0000000000 65535 f 
0000000000 65535 f 
0000000553 00000 n 
0000000000 65535 f 
0000000577 00000 n 
0000000900 00000 n 
trailer<</Size 23/Info 1 0 R/ID[<2753c66a6950982e644007ca4324fe83> 
<2753c66a6950982e644007ca4324fe83>]/Root 2 0 R>>
startxref
1175
%%EOF

PDFClown generates this (between stream and endstream there is binary data): PDFClown生成此文件(在流和结束流之间有二进制数据):

9 0 obj
<</Filter /FlateDecode /Length 60 >>
stream
Binary data
endstream
endobj
10 0 obj
<</Type /OCMD /P /AllOn /OCGs [8 0 R ] >>
endobj
11 0 obj
<</Type /XObject /Subtype /Form /BBox [0 0 594.71997 841.67999 ] /Resources 
<</Properties <</1 10 0 R >> >> /Filter /FlateDecode /Length 60 >>
stream
Binary data
endstream
endobj

How can I using PDFClown write the Bluebeam output? 如何使用PDFClown编写Bluebeam输出? Or at least how do I prevent using /Filter /FlateDecode? 或者至少如何防止使用/ Filter / FlateDecode?

The example PDF contents posted indicate that the kind of line graphics your target PDF editing software can edit are not the paths in the page content but instead PolyLine annotations . 张贴的示例PDF内容表明,目标PDF编辑软件可以编辑的线型不是页面内容中的路径,而是PolyLine 注释

You can create a simple PolyLine annotation with PDF Clown like this: 您可以使用PDF Clown创建一个简单的PolyLine注释,如下所示:

org.pdfclown.files.File file = new org.pdfclown.files.File();
Document document = file.Document;
Page page = new Page(document);
document.Pages.Add(page);

new Polyline(page, page.Box, "Test-PolyLine")
{
    Color = new DeviceRGBColor(1, 0, 0),
    Vertices = new List<PointF>() { new PointF(50, 50), new PointF(50, 250), new PointF(150, 150), new PointF(250, 250), new PointF(250, 50) }
};

file.Save("PolyLine-PdfClown.pdf", SerializationModeEnum.Standard);

The result in Adobe Reader: 在Adobe Reader中的结果:

屏幕截图

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM