Hi Ulrich
I just can say YOU ARE THE BEST.
You saved me.
Ttank you!
Announcement
Collapse
No announcement yet.
Help with hpdf
Collapse
X
-
This is not an error in the LuaPDF or the libHaru library I provided, and you are using, but there are several problems in your code.
Before you can output text in Haru, you need to activate the Text mode. This is done with
Code:hpdf.Page_BeginText(page);
Then you have three problems with your call to hpdf.Page_TextRect():
First, you inverted the order of the arguments in the attached APZ, where you wrote this:
Code:hpdf.Page_TextRect(page,0,0,200,200, HPDF_TALIGN_JUSTIFY,ementa);
Code:hpdf.Page_TextRect(page, 0, 792, 200, 200, ementa, "HPDF_TALIGN_JUSTIFY");
You can find a corrected version of your project attached.
UlrichAttached Files
Leave a comment:
-
Hi kingzooly
I am sending the APZ. Thank you for your help. This is very important.
ThanksAttached Files
Leave a comment:
-
HPDF_TA LIGN_JUSTIFY might not be set you might have to set these yourself also you added another commor after HPDF_TA LIGN_JUSTIFY
hpdf.Page_TextRect(page,0,0,200,200,ementa,HPDF_TA LIGN_JUSTIFY,);
Find out what HPDF_TA LIGN_JUSTIFY is meant to say or equal and add it manually "WHATEVERITIS" rather then the HPDF_TA LIGN_JUSTIFY or before define HPDF_TA LIGN_JUSTIFY = "WhatEverITsMeantToBe";
also if local ementa = is multi line then do
local ementa = [[Esse é um texto muito específico e longo. Sua função é testar a funcionalidade de colocação de um texto justificado dentro de um determindo espaço de página. Vamos ver se funciona. Parece bom!]];
if its not multi lined then you can get ways with
local ementa =Esse é um texto muito específico e longo. Sua função é testar a funcionalidade de colocação de um texto justificado dentro de um determindo espaço de página. Vamos ver se funciona. Parece bom!";
Better if you explore the APZ, file and export so we can look at your app to see what could be going wrong.
Leave a comment:
-
Help with hpdf
Hi.
I am using libHaru in a Lua Script (AutoPlay Media Studio). Everything is ok BUT I cannot use the command HPDF_Page_TextRect().
Ex:
require "hpdf"
local pdf = hpdf.New()
if pdf then
local page = hpdf.AddPage(pdf)
hpdf.Page_SetSize(page, HPDF_PAGE_SIZE_A4, HPDF_PAGE_PORTRAIT)
local height = hpdf.Page_GetHeight(page)
local width = hpdf.Page_GetWidth(page)
--Cabeçalho
local image = hpdf.LoadPngImageFromFile(pdf,"esquerda.png")
local image2 = hpdf.LoadPngImageFromFile(pdf,"direita.png")
hpdf.Page_DrawImage(page,image, 30, height - 100, 138, 50.5)
hpdf.Page_DrawImage(page,image2, width-30-140.5, height - 100, 140.5, 50,5)
--Identificação
local font = hpdf.GetFont(pdf, "Times-Bold", "WinAnsiEncoding")
hpdf.Page_SetFontAndSize(page, font, 12)
hpdf.Page_BeginText(page)
hpdf.Page_TextOut(page, 30, height - 250, "Processo:")
hpdf.Page_TextOut(page, 30, height - 275, "Interessado:")
hpdf.Page_EndText(page)
This works very well. Now, I will try to add a long text in a rectangle and justify it.
local ementa = "Esse é um texto muito específico e longo. Sua função é testar a funcionalidade de colocação de um texto justificado dentro de um determindo espaço de página. Vamos ver se funciona. Parece bom!";
hpdf.Page_TextRect(page,0,0,200,200,ementa,HPDF_TA LIGN_JUSTIFY,);
hpdf.Page_TextRect does not work. The IDE says that the 7th argument must be 'string'. This is a string. I tryed to change the place of arguments to hpdf.Page_TextRect(page,0,0,200,200,ementa,HPDF_TA LIGN_JUSTIFY,);
In this case the problem is in the 7th argument.
I think about compile libhpdf to the last version (2.3) but I gave up, I don't know how.
Any help?
Thsnks
2 PhotosTags: None
Leave a comment: