Development Paths versus Production Paths (and issues with ReportPDF application)

I have searched up the manual and the forum extensively about this and haven’t found a complete answer.

I’m very confused about these paths, where to set them up, how to use them, where are they stored in the generated files, is there global variables ?

Let me expose what I know and I’ll ask you my questions at the end.

#1. Within Scriptcase, I can set up the paths below

#2. Within applications, we can set up the 2 paths below

#3. When we deploy (advanced mode), we can set up the 4 paths below

#4. When I use an Application Form and set up a “Image (File Name)” field or “Document (File Name)” field, the selected file ends up in the directory defined in #1 above. So this works properly.

QUESTIONS

Q1 . Why the “Documents” path is absolute and the “Image” path is relative ?

Q2 . How are the paths set up at the application level (see #2 above) used ? Do they surcharge the settins made in the developement environment (#1) ?

Q3 . From my development environment, to access the Image folder for instance, I have to prefix the image file name with “…/…/…/file/img” because the applications are in the “wwwroot\scriptcase\app” folder and the “img” and “doc” folders are in the wwwroot\scriptcase\file" folder. But from the production environment, I have to prefix the image name with “…/_lib/file/img”. How am I supposed to handle this in the code to write the code only once ?

Q4 . In a ReportPDF application, I have found out that the macro “sc_pdf_image()” used the “Layout PDF/Code” area can’t take a variable for its first parameter (image path name). Indeed I have tried many different ways to use a variable so I can get my image paths from somewhere else (config, database, global variable), but it looks like there is a problem with the forward slashes! See below. If I store the “…/…/…/file/img/” in a PHP variable and use it here instead, it does not work.

sc_pdf_image(’…/…/…/file/img/’ . $topImgName ,$topImgX,$topImgY,$topImgWidth,$topImgHeight, $fileExt);

So my question here is: how can I use the “sc_pdf_image()” function in the development and the production environment without having to replace this code when deploying?

I’m sure I must have missed something somewhere because everyone must have the same issue.

Thanks a lot for your assistance.

you can use the path
by ex:

Blockquote

$varn= “$code_classe_vb $periode”.“P”." $millesime $mill2.pdf";

$dirpat = $_SERVER[‘DOCUMENT_ROOT’]."/tmp";

$nom = “$dirpat/val”; // directory to create

// verify if it exists :
if (!(is_dir($nom)))  { 
      mkdir($nom);
      echo 'the directory '.$nom.' is create !';      
      }

if(isset([idelv])) {$pdf->Output("$nom/$varn", ‘FI’);}
//OR
if(isset([idelv])) {sc_pdf_output("$nom/$varn", ‘FI’);}

Blockquote

Thx.
I ended up searching all session variables and found out the ones I needed. I now assign my own global variables to make sure they don’t change.
Any idea about my question #4 ?

$image_file = ‘…/_lib/img/logo.jpg’;
$image_file_cefa = ‘…/_lib/img/grp__NM__bg__NM__cefa.png’;

$pdf->Image($image_file,‘15’,‘23’,‘45’,‘45’,’’,’’,’’,‘true’);
$pdf->Image($image_file_cefa,‘95’,‘20’,‘15’,‘10’,’’,’’,’’,‘true’);

then you can try

sc_pdf_image($image_file,‘15’,‘23’,‘45’,‘45’,’’,’’,’’,‘true’);

Thx nsch2308.
I did the test with what you proposed:

Blockquote
$image_file = ‘…/_lib/img/logo.jpg’;
$this->Pdf->Image($image_file,‘15’,‘23’,‘45’,‘45’,’’,’’,’’,‘true’); // in the “Layout PDF/Code” section, we must use “$this->Pdf”

This works :+1:

Blockquote
$image_file = ‘…/_lib/img/logo.jpg’;
sc_pdf_image($image_file,‘15’,‘23’,‘45’,‘45’,’’,’’,’’,‘true’);

This does not work.

I’ll mention this in the BUG section.

Thanks a lot.

this work to
declare
$image on event onRecords
and in interface PDF
on Code
$pdf->Image($image_file,‘15’,‘23’,‘45’,‘45’,’’,’’,’’,‘true’);

Ok. And do you know where is $pdf declared ?

i declare on record my variables and on pdf interace code $pdf-> on pdf document
$pdf is include in pdf doc

Ok. Thanks. I’ll take a look at this. Have a great day.

I’m with the same problem

I need to save the pdf documents uploaded with the document field (file name) in a folder at the root of the example project / var / www / html / MyProject / Documents and I want to read the pdfs with https://docs.google.com/ viewer? url = [document path]

I already tried everything and I can’t get it, any help is welcome


Estoy con el mismo problema

Yo necesito guardar los documentos pdf subidos con el campo documento(nombre archivo) en una carpeta en la raíz del proyecto ejemplo /var/www/html/MiProyecto/Documentos y quiero leerlos los pdf con https://docs.google.com/viewer?url=[ruta del documento]

ya intenté de todo y no logro conseguirlo, cualquier ayuda es bienvenida

I have a similar issue I am trying safe multiple PDF files based on member number as file name but it is only saving the first member and skipping the rest, I am using the pdf path in settings.