Unable to rotate text in PDF

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Unable to rotate text in PDF

David Bergkvist
I'm on Lasso 8.5.6 on Mac and trying to rotate text in a PDF I let Lasso create but with no luck.

I found a thread about something similar and in a post dated 2010-02-26 where Bil Corry finds a solution to a problem that Jolle had.

I have tried the code Bil put out and yes, I get it to rotate a PDF page that is included. But when I modify it and try to use the same code to rotate text it all comes out horizontal.

This is the code I use:

[
var('pdfinsert') = pdf_read(-file='testpdf.pdf');

var('pdf' = pdf_doc(
-nocompress,
-size = 'A4',
-title = 'Example',
-margins = array( 50,50,50,50)
));


loop(-from=0, -to=90, -by=5);
$pdf -> insertpage( $pdfinsert, 1,
-top = 0,
-left = 300,
-width = string(100+loop_count)+'%',
-height = string(100+loop_count)+'%',
-rotate=loop_count);
/loop;


loop(-from=0, -to=90, -by=5);
$pdf -> add( 'Text goes here',
-top = 0,
-left = 300,
-width = string(100+loop_count)+'%',
-height = string(100+loop_count)+'%',
-rotate=loop_count);
/loop;

$pdf -> close;

pdf_serve( -content = $pdf, -file = 'example.pdf', -inline);
]

There need to be a PDF with some text in it called "testpdf.pdf".
The second loop is added by me and it don't work, it just comes out horizontal.

I don't need to add a PDF and rotate it, I only need to place text in a given top/left position that is rotated 90 degees.
All suggestions (apart from upgrading to Lasso 9) would be great!

Thank you!

/David Bergkvist


#############################################################

Attend the Lasso Developer Conference 2013!
Sept 12-14, 2013 in Niagara Falls, Canada
http://www.lassosoft.com/LDC-niagara-falls-2013

#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Unable to rotate text in PDF

Jolle Carlestam-3
24 sep 2013 kl. 18:59 skrev David Bergkvist <[hidden email]>:

> I'm on Lasso 8.5.6 on Mac and trying to rotate text in a PDF I let Lasso create but with no luck.
>
> I found a thread about something similar and in a post dated 2010-02-26 where Bil Corry finds a solution to a problem that Jolle had.
>
> I have tried the code Bil put out and yes, I get it to rotate a PDF page that is included. But when I modify it and try to use the same code to rotate text it all comes out horizontal.
>
> This is the code I use:
>
> [
> var('pdfinsert') = pdf_read(-file='testpdf.pdf');
>
> var('pdf' = pdf_doc(
> -nocompress,
> -size = 'A4',
> -title = 'Example',
> -margins = array( 50,50,50,50)
> ));
>
>
> loop(-from=0, -to=90, -by=5);
> $pdf -> insertpage( $pdfinsert, 1,
> -top = 0,
> -left = 300,
> -width = string(100+loop_count)+'%',
> -height = string(100+loop_count)+'%',
> -rotate=loop_count);
> /loop;
>
>
> loop(-from=0, -to=90, -by=5);
> $pdf -> add( 'Text goes here',
> -top = 0,
> -left = 300,
> -width = string(100+loop_count)+'%',
> -height = string(100+loop_count)+'%',
> -rotate=loop_count);
> /loop;
>
> $pdf -> close;
>
> pdf_serve( -content = $pdf, -file = 'example.pdf', -inline);
> ]
>
> There need to be a PDF with some text in it called "testpdf.pdf".
> The second loop is added by me and it don't work, it just comes out horizontal.
>
> I don't need to add a PDF and rotate it, I only need to place text in a given top/left position that is rotated 90 degees.

If I recall you need the adjusted pdf java library that Bil provided. He added the rotate function to it.

I can sense the next question you have. No, I'm not sure how to get your hands on it. I don't do Lasso 8 stuff anymore. Can however dig some and see what I find.

HDB
Jolle

#############################################################

Attend the Lasso Developer Conference 2013!
Sept 12-14, 2013 in Niagara Falls, Canada
http://www.lassosoft.com/LDC-niagara-falls-2013

#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Unable to rotate text in PDF

Jolle Carlestam-3
24 sep 2013 kl. 19:04 skrev Jolle Carlestam <[hidden email]>:

> If I recall you need the adjusted pdf java library that Bil provided. He added the rotate function to it.
>
> I can sense the next question you have. No, I'm not sure how to get your hands on it. I don't do Lasso 8 stuff anymore. Can however dig some and see what I find.

Not sure if the adjusted pdf jar is needed or not, I did track it down and can send it to you directly. But before that, try this code:

var('pdf' = pdf_doc(
-nocompress,
-size = 'A4',
-title = 'Example',
-margins = array( 50,50,50,50)
));



loop(-from=0, -to=90, -by=5);
        $pdf -> drawtext('Text goes here',
        -top = 200,
        -left = 200,
        -rotate = loop_count);
/loop;





$pdf -> close;

pdf_serve( -content = $pdf, -file = 'example.pdf', -inline);


HDB
Jolle

#############################################################

Attend the Lasso Developer Conference 2013!
Sept 12-14, 2013 in Niagara Falls, Canada
http://www.lassosoft.com/LDC-niagara-falls-2013

#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Unable to rotate text in PDF

David Bergkvist
In reply to this post by Jolle Carlestam-3
Well, Bil indicated in one post back then that it would be added to 8.5.6 and his test works on my machine so I guess it was. His fix was here http://www.corry.biz/lasso/pdf.zip but that link don't work anymore.

So either my code is just wrong or his changes didn't make it into 8.5.6.

/David


24 sep 2013 kl. 19:04 skrev Jolle Carlestam <[hidden email]>:

>
> If I recall you need the adjusted pdf java library that Bil provided. He added the rotate function to it.
>
> I can sense the next question you have. No, I'm not sure how to get your hands on it. I don't do Lasso 8 stuff anymore. Can however dig some and see what I find.
>
> HDB
> Jolle
>
> #############################################################
>
> Attend the Lasso Developer Conference 2013!
> Sept 12-14, 2013 in Niagara Falls, Canada
> http://www.lassosoft.com/LDC-niagara-falls-2013
>
> #############################################################
> This message is sent to you because you are subscribed to
>  the mailing list Lasso
> [hidden email]
> To unsubscribe, E-mail to: <[hidden email]>
> Send administrative queries to  <[hidden email]>


#############################################################

Attend the Lasso Developer Conference 2013!
Sept 12-14, 2013 in Niagara Falls, Canada
http://www.lassosoft.com/LDC-niagara-falls-2013

#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Unable to rotate text in PDF

Jolle Carlestam-3
24 sep 2013 kl. 19:18 skrev David Bergkvist <[hidden email]>:

> So either my code is just wrong or his changes didn't make it into 8.5.6.

Your code was wrong. But I tried correct pdf -> add code and could not make it rotate. Draw_text worked though.

HDB
Jolle

#############################################################

Attend the Lasso Developer Conference 2013!
Sept 12-14, 2013 in Niagara Falls, Canada
http://www.lassosoft.com/LDC-niagara-falls-2013

#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

RE: Unable to rotate text in PDF

Rick Draper-2
In reply to this post by David Bergkvist
Hi Dave,

As Jolle noted, you have some issues with your code, but PDF_Doc->DrawText takes the -Rotate param...

From this thread.... http://lasso.2283332.n4.nabble.com/PDF-Rotate-text-only-in-a-table-td3119368.html 

-----------------
[PDF_Doc->DrawText] does support a -Rotate parameter.  I'll make sure it
gets documented.

Var( 'test') = pdf_doc;
$test->drawtext( 'testing', -top=144, -left=144, -rotate=-90);
$test->close;
pdf_serve ( -content=$test, -file='test.pdf');

Hope this helps,

[fletcher]
-----------------

Very best regards,

Rick



#############################################################

Attend the Lasso Developer Conference 2013!
Sept 12-14, 2013 in Niagara Falls, Canada
http://www.lassosoft.com/LDC-niagara-falls-2013

#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Solved: Unable to rotate text in PDF

David Bergkvist
The code from Jolle worked great so my problem is now solved!

Thank you very much!  :-)

/David


24 sep 2013 kl. 20:39 skrev "Rick Draper" <[hidden email]>:

> Hi Dave,
>
> As Jolle noted, you have some issues with your code, but PDF_Doc->DrawText takes the -Rotate param...
>
>> From this thread.... http://lasso.2283332.n4.nabble.com/PDF-Rotate-text-only-in-a-table-td3119368.html 
>
> -----------------
> [PDF_Doc->DrawText] does support a -Rotate parameter.  I'll make sure it
> gets documented.
>
> Var( 'test') = pdf_doc;
> $test->drawtext( 'testing', -top=144, -left=144, -rotate=-90);
> $test->close;
> pdf_serve ( -content=$test, -file='test.pdf');
>
> Hope this helps,
>
> [fletcher]
> -----------------
>
> Very best regards,
>
> Rick
>
>
>
> #############################################################
>
> Attend the Lasso Developer Conference 2013!
> Sept 12-14, 2013 in Niagara Falls, Canada
> http://www.lassosoft.com/LDC-niagara-falls-2013
>
> #############################################################
> This message is sent to you because you are subscribed to
>  the mailing list Lasso
> [hidden email]
> To unsubscribe, E-mail to: <[hidden email]>
> Send administrative queries to  <[hidden email]>


#############################################################

Attend the Lasso Developer Conference 2013!
Sept 12-14, 2013 in Niagara Falls, Canada
http://www.lassosoft.com/LDC-niagara-falls-2013

#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Solved: Unable to rotate text in PDF

Bil Corry-3
FWIW, if you had added the pdf_text type, it would have rotated the text:

$pdf -> add(pdf_text('Text goes here', ..., -rotate=loop_count));

The problem is that PDFDOC->add doesn't support the absolute positioning
via -top and -left (or at least it didn't work for me, I think it's meant
for adding objects in the flow of the document), so drawtext is the proper
way to do it since drawtext is used for absolute positioning.  Or at least
I think that's correct - it's been a long time since I've poked around at
the PDF tags.


- Bil



On Wed, Sep 25, 2013 at 12:07 AM, David Bergkvist <
[hidden email]> wrote:

> The code from Jolle worked great so my problem is now solved!
>
> Thank you very much!  :-)
>
> /David
>
>
> 24 sep 2013 kl. 20:39 skrev "Rick Draper" <[hidden email]>:
>
> > Hi Dave,
> >
> > As Jolle noted, you have some issues with your code, but
> PDF_Doc->DrawText takes the -Rotate param...
> >
> >> From this thread....
> http://lasso.2283332.n4.nabble.com/PDF-Rotate-text-only-in-a-table-td3119368.html
> >
> > -----------------
> > [PDF_Doc->DrawText] does support a -Rotate parameter.  I'll make sure it
> > gets documented.
> >
> > Var( 'test') = pdf_doc;
> > $test->drawtext( 'testing', -top=144, -left=144, -rotate=-90);
> > $test->close;
> > pdf_serve ( -content=$test, -file='test.pdf');
> >
> > Hope this helps,
> >
> > [fletcher]
> > -----------------
> >
> > Very best regards,
> >
> > Rick
> >
> >
> >
> > #############################################################
> >
> > Attend the Lasso Developer Conference 2013!
> > Sept 12-14, 2013 in Niagara Falls, Canada
> > http://www.lassosoft.com/LDC-niagara-falls-2013
> >
> > #############################################################
> > This message is sent to you because you are subscribed to
> >  the mailing list Lasso
> > [hidden email]
> > To unsubscribe, E-mail to: <[hidden email]>
> > Send administrative queries to  <[hidden email]>
>
>
> #############################################################
>
> Attend the Lasso Developer Conference 2013!
> Sept 12-14, 2013 in Niagara Falls, Canada
> http://www.lassosoft.com/LDC-niagara-falls-2013
>
> #############################################################
> This message is sent to you because you are subscribed to
>   the mailing list Lasso
> [hidden email]
> To unsubscribe, E-mail to: <[hidden email]>
> Send administrative queries to  <[hidden email]>
>

#############################################################

Attend the Lasso Developer Conference 2013!
Sept 12-14, 2013 in Niagara Falls, Canada
http://www.lassosoft.com/LDC-niagara-falls-2013

#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>