[poppler] utils\HtmlOutputDev.cc -> dumpAsXML - Rounded coordinates

Thibaut Brard thibaut.brard at gmail.com
Thu Jun 21 13:59:51 UTC 2018


Hello,

I suggest to name the parameter "-noroundcoord" (insted of
"-accuratecoordinates")
with that description: "do not round coordinates (with XML output only)"
Of course I'm open to any other suggestion

In attachment the new patch with fixed spacing

--
Cordialement / Regards
Thibaut Brard

2018-06-20 0:19 GMT+02:00 Albert Astals Cid <aacid at kde.org>:

> El dilluns, 11 de juny de 2018, a les 17:32:27 CEST, Thibaut Brard va
> escriure:
> >  Hello!
> >
> > I'm using poppler to convert PDF document into XML file and I'm facing
> few
> > problems with rounded coordinates.
> >
> > In my opinion, the xoutRound macro should be called only when generating
> > complex HTML documents, but not inside the dumpAsXML method (option :
> -xml):
> > when dealing with XML we wish to keep the floating precision.
> > (For backward-compatibility, this could be another option when calling
> > /pdftohtml)
> >
> > Do you agree or did I miss anything?
>
> The spacing is wrong, though that file spacing is nuts, that function at
> least
> seems to be reasonable and using two spaces for each indentation. Please
> amend
> the patch to do that.
>
> Also i don't think anyone would understand what
>   "enable accurate coordinates output (for XML post-processing)"
> actually means. I would like a reword of the sentence, possibly including
> the
> word "round", something like "Do not round coordinates" or similar.
>
> What do you think?
>
> Cheers,
>   Albert
>
>
> >
> >
> > PATCH utils\HtmlOutputDev.cc:
> >
> >   763  - fprintf(f,"<image top=\"%d\" left=\"%d\" ",xoutRound(img->yMin),
> > xoutRound(img->xMin));
> >   764  - fprintf(f,"width=\"%d\" height=\"%d\"
> ",xoutRound(img->xMax-img->
> > xMin),xoutRound(img->yMax-img->yMin));
> >   763  + fprintf(f,"<image top=\"%f\" left=\"%f\" ",img->yMin,img->xMin);
> >   764  + fprintf(f,"width=\"%f\" height=\"%f\"
> ",img->xMax-img->xMin,img->
> > yMax-img->yMin);
> >
> >
> >   771  - fprintf(f,"<text top=\"%d\" left=\"%d\" ",xoutRound(tmp->yMin),
> > xoutRound(tmp->xMin));
> >   772  - fprintf(f,"width=\"%d\" height=\"%d\"
> ",xoutRound(tmp->xMax-tmp->
> > xMin),xoutRound(tmp->yMax-tmp->yMin));
> >   771  + fprintf(f,"<text top=\"%f\" left=\"%f\" ",tmp->yMin,tmp->xMin);
> >   772  + fprintf(f,"width=\"%f\" height=\"%f\"
> ",tmp->xMax-tmp->xMin,tmp->
> > yMax-tmp->yMin);
> >
> >
> > Regards,
> > --Thibaut
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/poppler/attachments/20180621/c45f46c4/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-HtmlOutputDev-dumpAsXML-No-rounded-coordinates-x-y.patch
Type: application/octet-stream
Size: 3317 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/poppler/attachments/20180621/c45f46c4/attachment.obj>


More information about the poppler mailing list