pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Wilson <williamstonconsult...@gmail.com>
Subject Re: PDFBox + C# + generating images of PDF pages
Date Wed, 16 Dec 2009 02:55:42 GMT
The basic problem is that IKVM doesn't translate the Java graphics stuff to
.Net graphics.

What you have to do is create a .Net class that inherits from PageDrawer and
override its functions using .Net graphics objects instead of the Java
graphics objects.

Daniel Wilson

On Tue, Dec 15, 2009 at 4:18 PM, Patrick Linskey <plinskey@gmail.com> wrote:

> Hi,
>
> I'm using PDFBox from a C# app via IKVM. Stripping the text out of a PDF
> works great, but I've been unable to render a page as an image.
>
> I'm using PDFBox 0.7.3 with IKVM 0.40.0.1; I built my own FontBox and
> PDFBox DLLs as outlined below [1]. My test script fails with a
> NotImplementedException [2].
>
> Does anyone know if I should expect PDFBox + IKVM to be able to generate
> images of pages? If so, does anything jump out as particularly wrong about
> my configuration, or do you have any pointers to a happy configuration?
>
> Thanks,
>
> -Patrick
>
>
> [1] DLL build process:
>
> references="-reference:IKVM.AWT.WinForms.dll
> -reference:IKVM.OpenJDK.Core.dll -reference:IKVM.OpenJDK.Misc.dll
> -reference:IKVM.OpenJDK.SwingAWT.dll -reference:IKVM.OpenJDK.Text.dll
> -reference:IKVM.OpenJDK.Util.dll"
>
> ikvmc $references -target:library -out:FontBox.dll FontBox-0.1.0-dev.jar
> ikvmc -target:library -reference:FontBox.dll -out:PDFBox.dll
> PDFBox-0.7.3.jar
>
> [2] NotImplementedException:
> Test method PdfViewerTests.TextOnlyPdfToImage threw exception:
>  System.NotImplementedException: The method or operation is not
> implemented..
> org.pdfbox.util.PDFStreamEngine.processSubStream(PDPage aPage, PDResources
> resources, COSStream cosStream)
> org.pdfbox.util.PDFStreamEngine.processStream(PDPage aPage, PDResources
> resources, COSStream cosStream)
> org.pdfbox.pdfviewer.PageDrawer.drawPage(Graphics g, PDPage p, Dimension
> pageDimension)
> org.pdfbox.pdmodel.PDPage.convertToImage()
> ClaimCharter.View.Pdf.PdfPagePanel.PageToBytes() in
> C:\Users\admin\Desktop\document-charter\client\ClaimCharter\View\Pdf\PDFPagePanel.cs:
> line 49
> ClaimCharter.View.Pdf.PdfPagePanel.SetPage(PDPage pdfPage) in
> C:\Users\admin\Desktop\document-charter\client\ClaimCharter\View\Pdf\PDFPagePanel.cs:
> line 37
> ClaimCharterTestProject.Pdf.PdfViewerTests.TextOnlyPdfToImage() in
> C:\Users\admin\Desktop\document-charter\client\ClaimCharterTestProject\Pdf\PdfViewerTests.cs:
> line 75
>
>
> FTR, when I tried the same test with the DLLs that ship with PDFBox 0.7.3
> (linked against GNU Classpath), I get an UnsupportedOperationException:
>
> Test method PdfViewerTests.AllTextPdfToImage threw exception:
>  java.lang.UnsupportedOperationException: type not implemented
> yet.java.awt.image.BufferedImage..ctor(Int32 w, Int32 h, Int32 type)
> org.pdfbox.pdmodel.PDPage.convertToImage()
> ClaimCharter.View.Pdf.PdfPagePanel.PageToBytes() in
> C:\Users\admin\Desktop\document-charter\client\ClaimCharter\View\Pdf\PDFPagePanel.cs:
> line 49
> ClaimCharter.View.Pdf.PdfPagePanel.SetPage(PDPage pdfPage) in
> C:\Users\admin\Desktop\document-charter\client\ClaimCharter\View\Pdf\PDFPagePanel.cs:
> line 37
> ClaimCharterTestProject.Pdf.PdfViewerTests.AllTextPdfToImage() in
> C:\Users\admin\Desktop\document-charter\client\ClaimCharterTestProject\Pdf\PdfViewerTests.cs:
> line 75
>
> --
> Patrick Linskey
> 202 669 5907
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message