How I can resume text on next page after this page is ended?For Local W = 1 TO 10000
page:ShowText(array1$[W-1]..";"..array2$[W-1]..";"..array3$[W-1]..";"..array4$[W-1]..";"..array5$[W-1]..";"..array6$[W-1]..";"..array7$[W-1]..";"..array8$[W-1]..";"..array9$[W-1]..";"..array10$[W-1])
page:MoveTextPos(0, -27)
pw = Max(pw, page:TextWidth(array1$[W-1]))
Next
Resume text from new page
Resume text from new page
I have arrays of strings
- airsoftsoftwair
- Posts: 5446
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: Resume text from new page
Add a new page to the document and use the new page's handle?
Re: Resume text from new page
I try but it is not work& text always on first page
- airsoftsoftwair
- Posts: 5446
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: Resume text from new page
Well, post your complete code then...
Re: Resume text from new page
Code: Select all
Function p_print()
if (exportformat=1)
; create new document
doc = pdf.CreateDocument()
; declaration for using Japanese encoding
doc:UseUTFEncodings()
; enable compression
doc:SetCompressionMode(#HPDF_COMP_ALL)
; load ttf file
detail_font_name = doc:LoadTTFont("DejaVuSans.ttf", True)
; add a new page object
page = doc:AddPage()
title_font = doc:GetFont("Helvetica")
detail_font = doc:GetFont(detail_font_name, "UTF-8")
page:SetFontAndSize(title_font, 10)
page:BeginText()
; move the position of the text to top of the page
page:MoveTextPos(50, 770)
page:SetFontAndSize(detail_font, 16)
pw = 0
page:SetSize(#HPDF_PAGE_SIZE_A4, #HPDF_PAGE_PORTRAIT)
; finish to print text
page:EndText()
kolvosranic=Round(countb/27)
For Local q = 1 TO kolvosranic
page = doc:AddPage()
Next
page:BeginText()
page:MoveTextPos(50, 770)
page:SetFontAndSize(detail_font, 16)
pw = 0
For Local W = 1 TO countb
page:ShowText(array1$[W-1]..";"..array2$[W-1]..";"..array3$[W-1]..";"..array4$[W-1]..";"..array5$[W-1]..";"..array6$[W-1]..";"..array7$[W-1]..";"..array8$[W-1]..";"..array9$[W-1]..";"..array10$[W-1])
page:MoveTextPos(0, -27)
pw = Max(pw, page:TextWidth(array1$[W-1]))
Next
page:EndText()
page:SetLineWidth(0.5)
; save the document to a file
p_SaveAndView(doc, "TTFontUnicode.pdf")
; clean up
doc:Free()
EndIf
- airsoftsoftwair
- Posts: 5446
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: Resume text from new page
Well, you always use the same page object in your loop so the text obviously is always put to the same page.
Re: Resume text from new page
Ок I try to understand examples and now I write this
Now I have this text on all pages from first W
How I can change line page:ShowText(array1$[W]) for making text on page 2 from 27 on page 3 from 55 etc
Code: Select all
Function p_DrawText(page)
kolvosranic=Round(countb/27)
For Local i = 0 To kolvosranic
page:BeginText()
page:MoveTextPos(x + 5, 850 - 75)
For Local W = 0 TO countb-1
page:ShowText(array1$[W])
page:MoveTextPos(0, -27)
Next
page:EndText()
Next
EndFunction
Function p_print()
if (exportformat=1)
; create new document
doc = pdf.CreateDocument()
; declaration for using Japanese encoding
doc:UseUTFEncodings()
; enable compression
doc:SetCompressionMode(#HPDF_COMP_ALL)
; load ttf file
detail_font_name = doc:LoadTTFont("DejaVuSans.ttf", True)
kolvosranic=Round(countb/27)
For Local i = 0 To kolvosranic
Local page = doc:AddPage()
Local font2
page:SetSize(#HPDF_PAGE_SIZE_A4, #HPDF_PAGE_PORTRAIT)
; Local outline = doc:CreateOutline(root, encodings[i], Nil)
Local dst = page:CreateDestination()
dst:SetXYZ(0, page:GetHeight(), 1)
detail_font = doc:GetFont(detail_font_name, "UTF-8")
page:SetFontAndSize(detail_font, 14)
; page:SetFontAndSize(font, 15)
p_DrawText(page)
page:BeginText()
page:SetFontAndSize(detail_font, 20)
page:MoveTextPos(50, 770)
page:ShowText(array2$[i])
page:EndText()
/* If encodings[i] = "Symbol-Set"
font2 = doc:GetFont("Symbol")
ElseIf encodings[i] = "ZapfDingbats-Set"
font2 = doc:GetFont("ZapfDingbats")
Else
font2 = doc:GetFont(font_name, encodings[i])
EndIf
page:SetFontAndSize(font2, 14)
p_DrawFonts(page)*/
Next
; save the document to a file
p_SaveAndView(doc, "TTFontUnicode.pdf")
; clean up
doc:Free()
EndIf
How I can change line page:ShowText(array1$[W]) for making text on page 2 from 27 on page 3 from 55 etc
- airsoftsoftwair
- Posts: 5446
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: Resume text from new page
Sorry, I'm not familiar with the libharu API used by Polybios either. I'm afraid you have to do some trial and error to see how it works.