You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Евгений Король <ff...@gmail.com> on 2019/02/07 11:29:21 UTC

Questions

Hello. I try to understand how to get Vector images from pdf file. I think
that viewport related to vector images on page of pdf document. Is that
right? How many vieports is how many vector images in pdf? And width and
height of viewport is related to vector images? Or vieports is related to
layers in Resources - Properties?

Re: Questions about viewports

Posted by Tilman Hausherr <TH...@t-online.de>.
There was no PDF file attached, such attachments are deleted, that's why 
I wrote "share". Anyway, according to the PDF specification:

https://www.adobe.com/content/dam/acom/en/devnet/pdf/pdfs/PDF32000_2008.pdf

    A viewport (PDF 1.6) is a rectangular region of a page. The optional
    VP entry in a page dictionary (see Table 30) shall specify an array
    of viewport dictionaries, whose entries shall be as shown in Table
    260. Viewports allow different measurement scales (specified by the
    Measure entry) to be used in different areas of a page, if necessary.

    The dictionaries in the VP array shall be in drawing order. Since
    viewports might overlap, to determine the viewport to use for any
    point on a page, the dictionaries in the array shall be examined,
    starting with the last one and iterating in reverse, and the first
    one whose BBox entry contains the point shall be chosen.



I don't see how this is related to layers. Viewports are for CAD documents.

What is the real problem you are working on?

Tilman

Am 08.02.2019 um 09:07 schrieb Евгений Король:
> Hello. On this pdf i have vector image. Pdf has a layers. I try to use 
> pdfbox lib in my Java project.
> I wrote code like this:
> PDDocument document = PDDocument.load(new 
> File("C:\\Users\\user\\Documents\\Примеры PDF\\тестовые файлы 
> PDFDocInfo\\07 642_ТР_1_1_КЖ9_АН_1 (вектор).pdf"));
>             PDPage page = document.getPage(0);
>             List<PDViewportDictionary> viewports = page.getViewports();
>             for (int i = 0; i < viewports.size(); i++) {
>                 System.out.println("Viewport " + (i+1));
>                 PDViewportDictionary get = viewports.get(i);
>                 PDRectangle bBox = get.getBBox();
>                 System.out.println("Размер "+bBox.getWidth()+" x 
> "+bBox.getHeight());
>             }
>
> When i get viewports from page, i can get Width and Height. What is 
> viewport means? Its like viewports for vector images on page or it is 
> viewports for layers of pdf file?
>
> пт, 8 февр. 2019 г. в 00:39, Tilman Hausherr <THausherr@t-online.de 
> <ma...@t-online.de>>:
>
>     Am 07.02.2019 um 12:29 schrieb Евгений Король:
>     > Hello. I try to understand how to get Vector images from pdf
>     file. I think
>     > that viewport related to vector images on page of pdf document.
>     Is that
>     > right? How many vieports is how many vector images in pdf? And
>     width and
>     > height of viewport is related to vector images? Or vieports is
>     related to
>     > layers in Resources - Properties?
>     >
>     I have no idea what you mean, although there is a concept of
>     viewports
>     in the PDF specification and PDFBox does support viewport
>     dictionaries.
>     Please share a PDF file and explain what you are trying to do.
>
>     Tilman
>
>
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>     <ma...@pdfbox.apache.org>
>     For additional commands, e-mail: users-help@pdfbox.apache.org
>     <ma...@pdfbox.apache.org>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org



Re: Questions about viewports

Posted by Евгений Король <ff...@gmail.com>.
Hello. On this pdf i have vector image. Pdf has a layers. I try to use
pdfbox lib in my Java project.
I wrote code like this:
PDDocument document = PDDocument.load(new
File("C:\\Users\\user\\Documents\\Примеры PDF\\тестовые файлы
PDFDocInfo\\07 642_ТР_1_1_КЖ9_АН_1 (вектор).pdf"));
            PDPage page = document.getPage(0);
            List<PDViewportDictionary> viewports = page.getViewports();
            for (int i = 0; i < viewports.size(); i++) {
                System.out.println("Viewport " + (i+1));
                PDViewportDictionary get = viewports.get(i);
                PDRectangle bBox = get.getBBox();
                System.out.println("Размер "+bBox.getWidth()+" x
"+bBox.getHeight());
            }

When i get viewports from page, i can get Width and Height. What is
viewport means? Its like viewports for vector images on page or it is
viewports for layers of pdf file?

пт, 8 февр. 2019 г. в 00:39, Tilman Hausherr <TH...@t-online.de>:

> Am 07.02.2019 um 12:29 schrieb Евгений Король:
> > Hello. I try to understand how to get Vector images from pdf file. I
> think
> > that viewport related to vector images on page of pdf document. Is that
> > right? How many vieports is how many vector images in pdf? And width and
> > height of viewport is related to vector images? Or vieports is related to
> > layers in Resources - Properties?
> >
> I have no idea what you mean, although there is a concept of viewports
> in the PDF specification and PDFBox does support viewport dictionaries.
> Please share a PDF file and explain what you are trying to do.
>
> Tilman
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>
>

Re: Questions about viewports

Posted by Tilman Hausherr <TH...@t-online.de>.
Am 07.02.2019 um 12:29 schrieb Евгений Король:
> Hello. I try to understand how to get Vector images from pdf file. I think
> that viewport related to vector images on page of pdf document. Is that
> right? How many vieports is how many vector images in pdf? And width and
> height of viewport is related to vector images? Or vieports is related to
> layers in Resources - Properties?
>
I have no idea what you mean, although there is a concept of viewports 
in the PDF specification and PDFBox does support viewport dictionaries. 
Please share a PDF file and explain what you are trying to do.

Tilman


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Re: Questions

Posted by Tilman Hausherr <TH...@t-online.de>.
Am 07.02.2019 um 12:29 schrieb Евгений Король:
> Hello. I try to understand how to get Vector images from pdf file. I think
> that viewport related to vector images on page of pdf document. Is that
> right? How many vieports is how many vector images in pdf? And width and
> height of viewport is related to vector images? Or vieports is related to
> layers in Resources - Properties?
>

See also here:

https://stackoverflow.com/questions/47772334/how-do-i-extract-viewport-from-a-pdf-and-modify-an-annotations-bounding-rectang


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org