Hello Michal,

2008/7/7 Michal Hocko <[EMAIL PROTECTED]>:
> On Mon, Jul 07, 2008 at 07:37:56PM +0300, Igor Stirbu wrote:
>> 2008/7/7 Michal Hocko <[EMAIL PROTECTED]>:
>> > On Mon, Jul 07, 2008 at 11:20:10AM +0300, Igor Stirbu wrote:
>> > Seems like document is read only. Are you sure that document is _not_
>> > linearized? Please note that manipulation with linearized document is
>> > not supported. You have to delinearize it before you can edit it.
>>
>> I've delinearized the document before running that script.
>
> Just to be sure - you have tried to delinearize document and used
> delinearized one (note that it is different one than the original) and
> you still get read-only exception?

I just can't tell right now if I've been using a delinearized document or
not but I've learned that a delinearized one should be worked with.

>> I tried to write a script without using the application but it seems
>> that it works better if integrated. In case you know how to fix that
>> script, please explain.
>
> What do you mean by "using the application"? Your patch which integrates
> that into the dialog rather than script which is run from gui without
> dialog?

First I tried to write the script because I was unaware how to integrate
with the app. After I failed I searched the web and found the patch for
multiple page metrics. Then I made the patch for multiple page tm
because my script failed.

>
> However your script:
>> function zoom()
>> {
>>       f = loadPdf("/home/istirbu/test.pdf");
>>       pg = f.getFirstPage();
>>       for(; f.hasNextPage(pg); pg = f.getNextPage(pg))
>>       {
>>               pg.setTransformMatrix([1.3,0,0,1.3,-90,-115]);
>>       }
>>       f.unloadPdf();
>> }
>
> doesn't work properly in some cases:
> * if document has only one page, for loop doesn't perform at all
>  (because 1st page doesn't have any next page).
>        - I would suggest simpler
>                for (i=f.getPage(1); i<= f.getPageCount(); ++i)
>
>        - or do {} while(f.hasNextPage) if you insist on iterator
>          approach

Yeah, well, if there is only one page then I probably wouldn't use
the script (I have few documents that have a lot of pages). But
your advice is correct.

> * I am also not sure whether unloadPdf saves changes
>  (src/gui/qspdf.cc:65 says that CPdf instance is simply dropped thus
>  no changes are saved - but I maybe I am missing something from
>  scripting POV).
>        - I would call f.save() before f.unloadPdf()

Well, you just made me realize that I've been struggling for a couple
of days and the solution was just a few keystrokes away. I've added
the f.save() and my script did it's job. The method 'save()' is not listed
among the methods of Pdf class and CObject is the only class Pdf is
inheriting so I didn't know I can call it. What did I miss?

Another thing I did not manage to run the script from command line,
ie transmit the pdf as a parameter. So if this is my current function,
how can it be called from outside with a file name parameter?

function zoom()
{
        var f = loadPdf("/home/istirbu/test.pdf");
        var pg = f.getFirstPage();
        for(; f.hasNextPage(pg); pg = f.getNextPage(pg))
        {
                pg.setTransformMatrix([1.3,0,0,1.3,-90,-115]);
        }
        f.save();
        f.unloadPdf();
}


Thanks,
Igor

-- 
:wq

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Pdfedit-support mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pdfedit-support

Reply via email to