John Davidson

javascript - PDFTron draw text sideways

0 comments
Message:


For my specific purpose user draw rectangle annotation on web viewer and later on replace that with Free-Text in the place of Rectangle annotation.



As you can see in above image i have added one rectangle. Now i am using below code to replace that rect annot with free text.


$text = FreeText::Create($pdf->GetSDFDoc(), new Rect( 440.0, 581.89, 454.0, 781.89));
$text->SetContents("The quick brown fox - 2");
$text->SetTextColor(new ColorPt(0.0, 0.0, 0.0), 3);
$text->SetOpacity(1.0);
$text->RefreshAppearance();
$page->AnnotPushBack($text);


FYI - i am getting: 440.0, 581.89, 454.0, 781.89 from DB using GetRect() method. I have saved annotation in DB. As you can see in above image replaced text is sideways.


So how to fix font sideways issue if page is horizontal?



My Answer:
tronWebViewer.getDocument(), new Rect(100, 100, 200, 200));
$text->SetContents("This is a sample text");
$text->SetRotation(90);
$pdftronWebViewer.getDocument()->PagePushBack($text);
$pdftronWebViewer.updateView();

Rate this post

3 of 5 based on 4011 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us