【问题标题】:Extracting vector graphics (lines and points) with pdfclown使用 pdfclown 提取矢量图形(线和点)
【发布时间】:2015-06-03 17:00:26
【问题描述】:

我想用 pdfclown 从 pdf 中提取矢量图形(线和点)。我试图将我的头脑围绕在图形样本上,但我无法弄清楚对象模型是如何工作的。请问谁能解释一下关系?

【问题讨论】:

  • 我投票决定将此问题作为离题结束,因为它没有询问有关现有代码的特定问题。它只是要求人们解释一个 3rd 方库。

标签: vector graphics pdfclown


【解决方案1】:

你是对的:直到 PDF Clown 0.1 系列,高级路径建模还没有实现(它应该是从 ContentScanner.GraphicsWrapper 派生的)。

下一个版本0.2 series,下个月到期)将支持所有图形内容的高级表示,包括路径对象(PathElement),通过新ContentModeller。这是一个例子:

import org.pdfclown.documents.contents.elements.ContentModeller;
import org.pdfclown.documents.contents.elements.GraphicsElement;
import org.pdfclown.documents.contents.elements.PathElement;
import org.pdfclown.documents.contents.objects.Path;

import java.awt.geom.GeneralPath;

for(GraphicsElement<?> element : ContentModeller.model(page, Path.class))
{
  PathElement pathElement = (PathElement)element;
  List<ContentMarker> markers = pathElement.getMarkers();
  pathElement.getBox();
  GeneralPath getPath = pathElement.getPath();
  pathElement.isFilled();
  pathElement.isStroked();
}

与此同时,您可以按照 ContentScanningSample(可在可下载的发行版中获得)中的建议,通过ContentScanner 提取迭代内容流的矢量图的低级表示,寻找与路径相关的操作(BeginSubpathDrawLine, DrawRectangle, DrawCurve, ...)。

【讨论】:

  • 谢谢。非常有建设性的回答。我在圣诞节像个孩子一样等待新版本!
  • Stefano,0.2 系列还没有发布,但你显然已经在 2015 年为它编写了很多代码并实现了很多功能。即使它你会考虑发布它是不是完全抛光?
猜你喜欢
  • 2012-08-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-05-16
  • 1970-01-01
  • 1970-01-01
  • 2013-02-14
相关资源
最近更新 更多