Quarto book won't reder to pdf after adding image (html works): Error running filter /opt/quarto/share/filters/quarto-init/quarto-init.lua - pdf

I am using quarto book in Rstudio. Rendering to pdf used to work but now that I have added an image it stopped working with the following error (Rendering to html still works perfectly):
Error running filter /opt/quarto/share/filters/quarto-init/quarto-init.lua:
/opt/quarto/share/filters/quarto-init/quarto-init.lua:246: attempt to index a nil value (global 'text')
stack traceback:
/opt/quarto/share/filters/quarto-init/quarto-init.lua:16: in local 'fn'
/opt/quarto/share/filters/quarto-init/quarto-init.lua:554: in function </opt/quarto/share/filters/quarto-init/quarto-init.lua:548>
Has someone encountered this before and knows what to do?
I have updated to the latest quarto (1.0.38) and Rstudio but the error still persists.

Solved.
The image path had an extra \ eg. \images\img1.png.
Once changed to images\img1.png. it worked fine

Related

How do you resolve 'Font was not found' error in visualWorks 8.1?

I have been using the report4pdf(bob nemec) package to generate reports as PDFs. Everything goes well except when I am trying to have some nice cell padding on the right.Thought an update would fix that.
So I connected to the public repository and updated the following:
Report4PDF 1.4.0.1
(comments said this was made to match with PDF Development 1.4.3.0 and Font Development 1.3.3.2. So updated those too).
However when I update and run the code it says,' Font not Found'.
Sure enough, when I run the debugger and 'inspect' on the self loadedFonts part from the debugger:
^self loadedFonts at: aSymbolOrFilenameString ifAbsent: [
FontNotFound raiseSignal: aSymbolOrFilenameString , ' was not found']
where: A symbolOrFilenameString= #'Helvetica-Bold'
As I opened the dictionary object, the font was there. Its just that the key didn't match. I am guessing the update changed all the keys except this one.
Anyway I hope you guys can help me out.
Thanks in Advance!
UPDATE 1:
Hi Bob! So I ran the ifNil block on the loadedFonts. But I hit a new error. It says: OrderedCollection(Collection)>>notFoundError.
So its trying to get something from
Graphic.Fonts.OpenType.CmapSubtable class>>classFor::`
The code being:
classFor: formatInteger
^self allSubclasses detect: [:sc | sc subclasses isEmpty and: [ sc formatNumber = formatInteger]]
=======
where formatInteger is 4.
Font class>>loadedFonts changed in the latest 'Fonts Basics' package, and Report4PDF was changed to use the new names. However, the LoadedFonts class variable in Graphics.Fonts.Font is initialized on the first reference. To get the new list, after loading the latest code, you need to run the ifNil: [] block in Font class>>loadedFonts.
In my image, with the latest code loaded, #'Helvetica-Bold' is defined in LoadedFonts.

Creating pdf from docx rendering library issue

If you know smth about this theme please leave a comment. I am trying to get pdf file from docx using phpoffice/word. But i cant make it real because for whole day testing i get only this error:
PHP Fatal error: Uncaught exception 'PhpOffice\PhpWord\Exception\Exception' with message 'PDF rendering library or library path has not been defined.
Please don't tell me to look this question in www, i tried - nothing helpful. My code:
require './vendor/autoload.php';
require './vendor/phpoffice/phpword/bootstrap.php';
$filename = 'example';
echo PHPWORD_BASE_DIR . '/TCPDF-master';
$wordPdf = \PhpOffice\PhpWord\IOFactory::load("./file_to_fill/ДКП квартира физики.docx");
$rendererName = \PhpOffice\PhpWord\Settings::PDF_RENDERER_TCPDF;
$rendererLibrary = 'TCPDF';
$rendererLibraryPath = dirname(__FILE__).'/'. $rendererLibrary;
\PhpOffice\PhpWord\Settings::setPdfRendererPath($rendererLibraryPath);
\PhpOffice\PhpWord\Settings::setPdfRendererName('TCPDF');
$pdfWriter = \PhpOffice\PhpWord\IOFactory::createWriter($wordPdf , 'PDF');
if (file_exists($filename.".pdf")) unlink($filename.".pdf");
$pdfWriter->save($filename.".pdf");
I know that my problem is library, but i really can't understand where the file of this library is. May be it happens because today for the first time i was trying to work with composer. I tried different library like dompdf and TCPDF and my be some others.
So if you have any ideas welcome.=)
So after many hours of searching and testing i got the working code. May be i am not only one need this.
For TCPDF library:
define('PHPWORD_BASE_DIR', realpath(__DIR__));
require './vendor/autoload.php';
require './TCPDF-master/tcpdf.php';
$PdfPath = realpath(PHPWORD_BASE_DIR . '/TCPDF-master');
\PhpOffice\PhpWord\Settings::setPdfRendererPath($PdfPath);
\PhpOffice\PhpWord\Settings::setPdfRendererName('TCPDF');
$phpWord = \PhpOffice\PhpWord\IOFactory::load('yourtemplate.docx');
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord , 'PDF');
$xmlWriter->save('result.pdf');
For mpdf library:
define('PHPWORD_BASE_DIR', realpath(__DIR__));
require './vendor/autoload.php';
require './vendor/mpdf/mpdf/mpdf.php';
$PdfPath = realpath(PHPWORD_BASE_DIR . '/vendor/mpdf/mpdf');
\PhpOffice\PhpWord\Settings::setPdfRendererPath($PdfPath);
\PhpOffice\PhpWord\Settings::setPdfRendererName('MPDF');
$phpWord = \PhpOffice\PhpWord\IOFactory::load('temp.docx');
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord , 'PDF');
$xmlWriter->save('result.pdf');
But the the domPDF doesn't work at all(
So this two libraries works but not good, one of it gives me "???" when i input the Russian text. And both of them gives a lot of different free space in document (may be margin). And i can't understand how edit it.

TCPDF created Document: Warning: TT: nested FDEFs not allowed

When ill try to create a PDF with TCPDF, ill get the following error in Firebug:
PDF ca1e64da17eae2f8ea6f8d0c29bd5b30 [1.7 TCPDF 6.2.9 (http://www.tcpdf.org) / TCPDF] (PDF.js: 1.1.114)
Warning: TT: nested FDEFs not allowed
Warning: TT: nested FDEFs not allowed
Warning: TT: ENDF bad stack
Warning: TT: nested FDEFs not allowed
Warning: TT: ENDF bad stack
Ill dont find any useful information about this error. Can anyone help what is wrong here? The PDF ist about 12 Pages long, so its hard to find any error with this warning.
Ill found out that the problem only comes when ill use custom fonts - ill registered my fonts with:
tcpdf_addfont.php
in the console, and the font is showed correctly in the Browser PDF Plugin, and still when ill print the document.
Any ideas? Thanks for any help in advance!

FPDF Fatal Error

I am trying to test implementation of FPDF. Below is the code I'm testing with, but it keeps giving me the error: "Fatal error: Class 'FPDF' not found in /home4/fwall/public_html/create-press-release.php on line 5". That is the URL to the page I am calling the below code on.
I have verified that the php file for FPDF is being required from the right spot, and it's still happening. Can anyone figure out what's going on?
require(__DIR__.'/fpdf.php'); //The fpdf folder is in my root directory.
//create a FPDF object
$pdf=new FPDF();
//set document properties
$pdf->SetAuthor('Lana Kovacevic');
$pdf->SetTitle('FPDF tutorial');
//set font for the entire document
$pdf->SetFont('Helvetica','B',20);
$pdf->SetTextColor(50,60,100);
//set up a page
$pdf->AddPage('P');
$pdf->SetDisplayMode(real,'default');
//insert an image and make it a link
//$pdf->Image('logo.png',10,20,33,0,' ','http://www.fpdf.org/');
//display the title with a border around it
$pdf->SetXY(50,20);
$pdf->SetDrawColor(50,60,100);
$pdf->Cell(100,10,'FPDF Tutorial',1,0,'C',0);
//Set x and y position for the main text, reduce font size and write content
$pdf->SetXY (10,50);
$pdf->SetFontSize(10);
$pdf->Write(5,'Congratulations! You have generated a PDF.');
//Output the document
$pdf->Output('example1.pdf','I');
This line:
require('http://siteurlredacted.com/fpdf/fpdf.php');
probably won't do what you expect. The request will make the remote server "execute" fpdf.php, returning a blank page, and your script will include an empty file. That is why it doesn't find any class to load.
You should download FPDF and put the file on your filesystem, where it is accesible to your script with no HTTP requests. You can try putting fpdf.php inside your project.
Hope this helps.

Prestashop admin panel is lost after trying to export language packet

There were some language problems in my site which uses a specific theme so I thought,I should pick out the language pack edit and reload it. Because I couldn't find a way to edit it using browser on admin panel.
I just pressed a button named export language packet. I don't know if something happened that time. But it didn't give me a file (an exported file I mean) . So I didn't do anything else. But since that time I can't reach my admin panel. While I write the URL it shows me a big white screen.
On the other side the site itself (not admin panel) is reachable. What can I do to fix my problem?
Hi,
This is the error
( ! ) SCREAM: Error suppression ignored for
( ! ) Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting ']' in C:\wamp\www\httpdocs\translations\tr\admin.php on line 586
Call Stack
# Time Memory Function Location
1 0.0009 690552 {main}( ) ..\index.php:0
2 1.7995 9942280 DispatcherCore->dispatch( ) ..\index.php:50
3 2.0567 10375504 ControllerCore::getController( ) ..\Dispatcher.php:342
4 2.0686 12512728 AdminControllerCore->__construct( ) ..\Controller.php:128
5 2.0689 12514200 AdminControllerCore->l( ) ..\AdminController.php:304
6 2.0711 12612344 TranslateCore::getAdminTranslation( ) ..\AdminController.php:1737
The error you got is in your translation file in file translations\tr\admin.php on line number 586.
To fix that error, take a backup of that file, i.e. keep a copy of that file in some other place, then try to find out the syntax error you got there. It is some kind of PHP syntax error there in that translation file. As the translation file is only for the admin section, therefore your site front end may be fine and your site admin section is not working.
If you are not able to find that error and fix it, then delete all contents from that file, and then try to load the admin section.
You should use a translation pack which is provided by prestashop, ie download it from the prestashop http://www.prestashop.com/en/translations .
Also if you want to edit translations, use admin. In your question you mentioned, that you were not able to edit translations, please do provide details for that problem, and also try to edit translations while keeping error reporting on, so if there is any problem, you will get the errors printed. If you got errors printed, then update your question with that error message.
Let me know if you still got any questions.