how about a class something like:

public class My_PageDrawer : org.apache.pdfbox.pdfviewer.PageDrawer
    {
         public void drawPage(System.Drawing.Graphics g,
            org.apache.pdfbox.pdmodel.PDPage p,
            java.awt.Dimension pageDimension){
              //logic very similar to that in the Java version ...
           }
        protected override void
processTextPosition(org.apache.pdfbox.util.TextPosition text)
        {

            //Translation of the one in pageDrawer.java to handle .NET
graphics object
         }


        public override void fillPath(int windingRule)
        {
            //translation to .Net objects
        }

        //etc.
  }

On Wed, Oct 28, 2009 at 6:15 AM, Raja Subramanian <raj...@sybrant.com>wrote:

> Dear Daniel,
>
> Here is my code:
>
> protected void btnPdf_Click(object sender, EventArgs e)
>
> {
>
> string str = FileUpload1.PostedFile.FileName;
>
> org.pdfbox.pdfviewer.PageDrawer pagedrawer = new
> org.pdfbox.pdfviewer.PageDrawer();
>
>
> PDDocument document = PDDocument.load(str);
>
> java.util.List pages= document.getDocumentCatalog().getAllPages();
>
> for(int i=0;i<pages.size();++i)
>
> {
>
> //PDPage page =(PDPage)pages.get(i);
>
>
> PDPage page =pagedrawer.getPage()
>
> //System.Drawing.Graphics image = page.convertToImage();
>
>
> java.awt.image.BufferedImage image=page.convertToImage();
>
> java.io.File file = new java.io.File(("pdf"+i+".png"));
>
> ImageIO.write(image, "png", file);
>
> }
>
> }
>
> ----- Original Message ----- From: "Daniel Wilson" <
> williamstonconsult...@gmail.com>
> To: <pdfbox-users@incubator.apache.org>
> Sent: Wednesday, October 28, 2009 3:36 PM
>
> Subject: Re: Reg:Converting pdf into image.
>
>
>  Can you share your pagedrawer class's code?
>>
>> On Wed, Oct 28, 2009 at 1:49 AM, Raja Subramanian <raj...@sybrant.com
>> >wrote:
>>
>>  Dear Daniel,
>>>
>>> As Per your Advice I have created pagedrawer class and by using that
>>> pagedrawer class instance am trying to get the pdf page by using
>>> getpage()
>>> method. but it always giving an null as a result.so while coming to
>>> convertToImage() method its giving the object null reference error.so i
>>> am
>>> struggling to move further.
>>>
>>> please assit me to move further.
>>>
>>>
>>> Thanks in advance.
>>> RajaSubramanian.
>>>
>>>
>>>
>>> ----- Original Message ----- From: "Daniel Wilson" <
>>> williamstonconsult...@gmail.com>
>>> To: <pdfbox-users@incubator.apache.org>
>>> Sent: Tuesday, October 27, 2009 7:22 PM
>>>
>>> Subject: Re: Reg:Converting pdf into image.
>>>
>>>
>>>  Oh yeah, how could I forget?
>>>
>>>>
>>>> You need to derive a class from PageDrawer.  Create it in your favorite
>>>> .Net
>>>> language, inheriting PageDrawer.  And override all those drawing
>>>> functions
>>>> in that class.  Or most anyway.
>>>>
>>>> B/c you can't use a java ...BufferedImage.  You need a
>>>> system.Drawing.Graphics ... something.  I'd have to dig up my code to
>>>> say
>>>> specifically.
>>>>
>>>> The code I created that does that is proprietary ... but I can give some
>>>> more hints as you have particular questions.
>>>>
>>>> Daniel
>>>>
>>>> On Tue, Oct 27, 2009 at 9:39 AM, Raja Subramanian <raj...@sybrant.com
>>>> >wrote:
>>>>
>>>>  Hi Daniel,
>>>>
>>>>>
>>>>> Thanks for Continuesly replying me.
>>>>> i got a sample code from the path you specfied.
>>>>> Please keep in mind that i am working in DOT NET Enviornment.
>>>>>
>>>>>
>>>>> CODE:
>>>>>
>>>>> PDDocument document = PDDocument.load(str);
>>>>> java.util.List pages= document.getDocumentCatalog().getAllPages();
>>>>> for(int i=0;i<pages.size();++i)
>>>>> {
>>>>> PDPage page =(PDPage)pages.get(i);
>>>>> java.awt.image.BufferedImage image=page.convertToImage();
>>>>> java.io.File file = new java.io.File(("pdf"+i+".png"));
>>>>> ImageIO.write(image, "png", file);
>>>>>
>>>>>
>>>>> while running the above code in my IDE in line
>>>>> java.awt.image.BufferedImage
>>>>> image=page.convertToImage();
>>>>> am getting an error that Type is not implemented yet.
>>>>> so now i am help less to move further.
>>>>> so anyone please help me to move further.
>>>>> Thanks in Advance.
>>>>>
>>>>> Regards,
>>>>> Raja Subramanian.
>>>>>
>>>>>
>>>>> ----- Original Message ----- From: "Daniel Wilson" <
>>>>> williamstonconsult...@gmail.com>
>>>>> To: <pdfbox-users@incubator.apache.org>
>>>>> Sent: Tuesday, October 27, 2009 6:56 PM
>>>>>
>>>>> Subject: Re: Reg:Converting pdf into image.
>>>>>
>>>>>
>>>>>  I primarily use .Net as well.
>>>>>
>>>>>
>>>>>> Are you using the .Net DLL's provided in
>>>>>> https://issues.apache.org/jira/browse/PDFBOX-535 ?
>>>>>>
>>>>>> The object model is the same ... so the java code to which I directed
>>>>>> you
>>>>>> remains the primary example.
>>>>>>
>>>>>> Daniel
>>>>>>
>>>>>> On Tue, Oct 27, 2009 at 9:08 AM, Raja Subramanian <raj...@sybrant.com
>>>>>> >wrote:
>>>>>>
>>>>>>  Hi Daniel Wilson,
>>>>>>
>>>>>>
>>>>>>>  Thanks for your reply.
>>>>>>>  I am not using java.I am using Dot Net(C#/Vb.net).
>>>>>>>  please assit me to proceed further.
>>>>>>>
>>>>>>> Thanks and Regards,
>>>>>>> Raja Subramanaian.
>>>>>>>
>>>>>>> ----- Original Message ----- From: "Daniel Wilson" <
>>>>>>> williamstonconsult...@gmail.com>
>>>>>>> To: <pdfbox-users@incubator.apache.org>
>>>>>>> Sent: Tuesday, October 27, 2009 6:28 PM
>>>>>>> Subject: Re: Reg:Converting pdf into image.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>  Please see the code in
>>>>>>>
>>>>>>>  trunk\src\main\java\org\apache\pdfbox\PDFToImage.java.
>>>>>>>
>>>>>>>>
>>>>>>>> You may well want to adjust it to your needs, but that is the
>>>>>>>> primary
>>>>>>>> example for that work.
>>>>>>>>
>>>>>>>> Daniel Wilson
>>>>>>>>
>>>>>>>> On Tue, Oct 27, 2009 at 7:47 AM, Raja Subramanian <
>>>>>>>> raj...@sybrant.com
>>>>>>>> >wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>  Dear sir/madam,
>>>>>>>>
>>>>>>>>>
>>>>>>>>>            I am Raja Subramanian.I have to convert pdf into
>>>>>>>>> images(any
>>>>>>>>> type).i am trying with pdfbox from yesterday.i have no idea how to
>>>>>>>>> approach
>>>>>>>>> this task.is there any samples(work around) available converting
>>>>>>>>> pdf
>>>>>>>>> documents into images by using pdfbox? if yes means please assit me
>>>>>>>>> to
>>>>>>>>> move
>>>>>>>>> further.now i am help less to achive this task.i have downloaded
>>>>>>>>> pdfbox
>>>>>>>>> and
>>>>>>>>> integrated with my visual studio 2008 IDE.
>>>>>>>>> please assit me.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>  Thanks in advance.
>>>>>>>>>
>>>>>>>>> Thanks and regards,
>>>>>>>>> Raja Subramanian.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>

Reply via email to