PDFToImage already is a console app.  Note the main() method's handling of
command-line params.

If you want to write your own console app, use the objects PDFToImage uses.
See lines 134, 137, 164, 165.

PDDocument document  PDDocument.load( pdfFile );

        PDFImageWriter W = new PDFImageWriter();
        W.WriteImage(document, imageType, password, startPage, endPage,
outputPrefix);


On Sun, Jan 11, 2009 at 2:52 PM, A B <[email protected]> wrote:

> How do I write a simple console C# app using this class?
>
> --------------------------------------------------------------------------------
> This following console app attempts to use the PDFToImage class (at bottom
> of this post):
> Code:
>
> class MainClass
> {
>     [STAThread]
>     public static void Main(string[] args)
>     {
>         if (args.Length < 6)
>         {
>             Console.WriteLine("Usage: PDF2JPEG <-password> <-startPage>
> <-endPage> <-imageType> <-outputPrefix> <PDF file>");
>             return;
>         }
>         using (StreamWriter sw = new StreamWriter(args[5]))
>         {
>             sw.WriteLine(transformPDFToImage(args[0]));
>         }
>     }
>     private static string transformPDFToImage(string input)
>     {
>         whatdoiwritehere?PDFToImage(input);...?
>     }
> }
>
>
> I've tried...
> Code:
>
> PDFToImage pdf2i = new PDFToImage(input);
>
> ...but the compiler responds with The type 'org.pdfbox.PDFToImage' has no
> constructors defined(CS0143)
>
>
> If I write...
> Code:
>
> PDFToImage pdf2i = new PDFToImage();
>
> ...the compiler responds with 'pdf2i' is a 'variable' but is used like a
> 'method'(CS0118)
>
>
> Thanks for any help.
>
> For reference, here's the PDFToImage class definition (written in Java).
> (In my library, it's since been dotnetized, using IKVM, into a
> .NET-referenceable DLL):
> http://svn.apache.org/repos/asf/incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/PDFToImage.java
>
>
>

Reply via email to