You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Ranjit Saripalli <ra...@gmail.com> on 2018/07/23 06:50:52 UTC

How to identify underlying COSObject for a PDXObject or PDXObject for COSObject

Hi,

I am trying to get location (Rectangle) of a COSObject but it seems only
xcoordinate and ycoordinate information is available for COSObject. I can
get the required details (location) from a PDXobject (PDXImage and
PDXFormObject) which is good but I am not able to find a corresponding
COSObject ( from PDXObject) and PDXObject has no User attribute values. I
need both user attribute information and location, unfortunately I cannot
get both from either one object (XObject or COSObject).

I was hoping to somehow identify COSObject from a PDXObject so I can get
location from XObject and then attribute values from corresponding
COSObject.

Could someone please share a way to identify corresponding COSObject from
an XObject or a way to get both user attribute values and location of an
element in PDF?

Thanks in advance.

Re: How to identify underlying COSObject for a PDXObject or PDXObject for COSObject

Posted by Tilman Hausherr <TH...@t-online.de>.
Hi,

I don't know what that is. Maybe this is user provided information. Or 
maybe PDF 2.0? Can you share the PDF with this? If not, could you look 
at the PDF with PDFDebugger and then share a screenshot?

You can include screenshots on the mailing list if they are inlined. 
Thunderbird can do it, I don't know about other tools. Or upload it to 
an image share site like https://imgur.com/

Tilman


Am 23.07.2018 um 19:12 schrieb Ranjit Saripalli:
> Hi Tilman,
>
> Thanks for you response. I can get position of the image in pdf as it is
> in  printimagelocations example but I am trying to get the the location of
> COSObject.
>
>   Let me try to keep my question simple, I have a COSObject with X and Y
> coordinate values  as below. How to get the actual location (lowerleftX,
> lowerleftY, upperrightX, upperrightY) of this object from this X and Y
> coordinates.
>
> COSDictionary{COSName{N}:COSString{xcoordinate};COSName{V}:COSString{
> 0,220000000000001};}, COSDictionary{COSName{N}:COSString{ycoordinate
> };COSName{V}:COSString{0,22};},
>
>
> Thanks,
> Ranjit
>
> On Mon, Jul 23, 2018 at 10:06 PM, Tilman Hausherr <TH...@t-online.de>
> wrote:
>
>> Hi, I'm not sure if this is the answer to your question (which I haven't
>> really understood), but please try the PrintImageLocations.java example
>> from the source code download.
>>
>> Image objects do not know their own location(s).
>>
>> Tilman
>>
>>
>> Am 23.07.2018 um 08:50 schrieb Ranjit Saripalli:
>>
>>> Hi,
>>>
>>> I am trying to get location (Rectangle) of a COSObject but it seems only
>>> xcoordinate and ycoordinate information is available for COSObject. I can
>>> get the required details (location) from a PDXobject (PDXImage and
>>> PDXFormObject) which is good but I am not able to find a corresponding
>>> COSObject ( from PDXObject) and PDXObject has no User attribute values. I
>>> need both user attribute information and location, unfortunately I cannot
>>> get both from either one object (XObject or COSObject).
>>>
>>> I was hoping to somehow identify COSObject from a PDXObject so I can get
>>> location from XObject and then attribute values from corresponding
>>> COSObject.
>>>
>>> Could someone please share a way to identify corresponding COSObject from
>>> an XObject or a way to get both user attribute values and location of an
>>> element in PDF?
>>>
>>> Thanks in advance.
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>
>>


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


Re: How to identify underlying COSObject for a PDXObject or PDXObject for COSObject

Posted by Marc Kaufman <ka...@cs.stanford.edu>.
A PDF XObject doesn't have a unique position. The ultimate position on 
the page is determined by the current transformation matrix in the 
content stream:

    The BBox entry in the form dictionary is expressed in form space, as
    are any coordinates used in the form XObject’s content stream, such
    as path coordinates. The Matrix entry in the form dictionary
    specifies the mapping from form space to the current user space.
    Each time the form XObject is painted by the Do operator, this
    matrix is concatenated with the current transformation matrix to
    define the mapping from form space to device space.


On 7/23/2018 10:12 AM, Ranjit Saripalli wrote:
> Hi Tilman,
>
> Thanks for you response. I can get position of the image in pdf as it is
> in  printimagelocations example but I am trying to get the the location of
> COSObject.
>
>   Let me try to keep my question simple, I have a COSObject with X and Y
> coordinate values  as below. How to get the actual location (lowerleftX,
> lowerleftY, upperrightX, upperrightY) of this object from this X and Y
> coordinates.
>
> COSDictionary{COSName{N}:COSString{xcoordinate};COSName{V}:COSString{
> 0,220000000000001};}, COSDictionary{COSName{N}:COSString{ycoordinate
> };COSName{V}:COSString{0,22};},
>
>
> Thanks,
> Ranjit
>
> On Mon, Jul 23, 2018 at 10:06 PM, Tilman Hausherr <TH...@t-online.de>
> wrote:
>
>> Hi, I'm not sure if this is the answer to your question (which I haven't
>> really understood), but please try the PrintImageLocations.java example
>> from the source code download.
>>
>> Image objects do not know their own location(s).
>>
>> Tilman
>>
>>
>> Am 23.07.2018 um 08:50 schrieb Ranjit Saripalli:
>>
>>> Hi,
>>>
>>> I am trying to get location (Rectangle) of a COSObject but it seems only
>>> xcoordinate and ycoordinate information is available for COSObject. I can
>>> get the required details (location) from a PDXobject (PDXImage and
>>> PDXFormObject) which is good but I am not able to find a corresponding
>>> COSObject ( from PDXObject) and PDXObject has no User attribute values. I
>>> need both user attribute information and location, unfortunately I cannot
>>> get both from either one object (XObject or COSObject).
>>>
>>> I was hoping to somehow identify COSObject from a PDXObject so I can get
>>> location from XObject and then attribute values from corresponding
>>> COSObject.
>>>
>>> Could someone please share a way to identify corresponding COSObject from
>>> an XObject or a way to get both user attribute values and location of an
>>> element in PDF?
>>>
>>> Thanks in advance.
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>
>>


Re: How to identify underlying COSObject for a PDXObject or PDXObject for COSObject

Posted by Ranjit Saripalli <ra...@gmail.com>.
Hi Tilman,

Thanks for you response. I can get position of the image in pdf as it is
in  printimagelocations example but I am trying to get the the location of
COSObject.

 Let me try to keep my question simple, I have a COSObject with X and Y
coordinate values  as below. How to get the actual location (lowerleftX,
lowerleftY, upperrightX, upperrightY) of this object from this X and Y
coordinates.

COSDictionary{COSName{N}:COSString{xcoordinate};COSName{V}:COSString{
0,220000000000001};}, COSDictionary{COSName{N}:COSString{ycoordinate
};COSName{V}:COSString{0,22};},


Thanks,
Ranjit

On Mon, Jul 23, 2018 at 10:06 PM, Tilman Hausherr <TH...@t-online.de>
wrote:

> Hi, I'm not sure if this is the answer to your question (which I haven't
> really understood), but please try the PrintImageLocations.java example
> from the source code download.
>
> Image objects do not know their own location(s).
>
> Tilman
>
>
> Am 23.07.2018 um 08:50 schrieb Ranjit Saripalli:
>
>> Hi,
>>
>> I am trying to get location (Rectangle) of a COSObject but it seems only
>> xcoordinate and ycoordinate information is available for COSObject. I can
>> get the required details (location) from a PDXobject (PDXImage and
>> PDXFormObject) which is good but I am not able to find a corresponding
>> COSObject ( from PDXObject) and PDXObject has no User attribute values. I
>> need both user attribute information and location, unfortunately I cannot
>> get both from either one object (XObject or COSObject).
>>
>> I was hoping to somehow identify COSObject from a PDXObject so I can get
>> location from XObject and then attribute values from corresponding
>> COSObject.
>>
>> Could someone please share a way to identify corresponding COSObject from
>> an XObject or a way to get both user attribute values and location of an
>> element in PDF?
>>
>> Thanks in advance.
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>
>

Re: How to identify underlying COSObject for a PDXObject or PDXObject for COSObject

Posted by Tilman Hausherr <TH...@t-online.de>.
Hi, I'm not sure if this is the answer to your question (which I haven't 
really understood), but please try the PrintImageLocations.java example 
from the source code download.

Image objects do not know their own location(s).

Tilman

Am 23.07.2018 um 08:50 schrieb Ranjit Saripalli:
> Hi,
>
> I am trying to get location (Rectangle) of a COSObject but it seems only
> xcoordinate and ycoordinate information is available for COSObject. I can
> get the required details (location) from a PDXobject (PDXImage and
> PDXFormObject) which is good but I am not able to find a corresponding
> COSObject ( from PDXObject) and PDXObject has no User attribute values. I
> need both user attribute information and location, unfortunately I cannot
> get both from either one object (XObject or COSObject).
>
> I was hoping to somehow identify COSObject from a PDXObject so I can get
> location from XObject and then attribute values from corresponding
> COSObject.
>
> Could someone please share a way to identify corresponding COSObject from
> an XObject or a way to get both user attribute values and location of an
> element in PDF?
>
> Thanks in advance.
>


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