-
Notifications
You must be signed in to change notification settings - Fork 537
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using PdfParser without Composer #117
Comments
Wow Man, You are great, that really awesome and worked for me... Thanks a TON!!! |
Sir its simply great. Can you also help to install Tesseract OCR for php without composer? |
I have not used this wrapper: Tesseract OCR for PHP. If you succeed in deploying it, do let us know what issues crop up. I have only used the compiled version of Tesseract OCR. |
WOW sweet work ..love from pakistan. |
Great hint apmuthu...this solve my issue since I cannot run composer on my remote server. after that I've added this method into the controller: but when I try to execute the method I get the following error: Any hint to solve this? Thanks a lot |
Make the path to the autoload relative like (or completely absolute with full linux path):
|
What exactly you mean by „freeze“? Composer doesn’t update any files until you run „composer update“ and you don’t change your composer.json and/or composer.lock files. Therefore, just run “composer update” on your instance and enjoy?! |
For those who cannot use composer for whatever reason (offline, stability, unfamiliarity, etc), this thread lists an alternative. |
I really do wish this was baked into pdfparser (and other projects that assume Composer). I don't use Composer, and don't want to add yet another dependency/package manager for one project submodule. Composer isn't installed in my production environment. I don't mean to suggest ejecting Composer (it's a common standard and super easy if you're already using it), but simply including an installation procedure that doesn't require Composer. An example would be the DOMPDF project. In any case, thanks @apmuthu for this post. |
Also: |
@ndmax: Thanks for the info and glad for the +1 composer-less implementation initiative. Yes, you're right, the renaming of the file will now require, in the code snippet above, the replacement of the line:
with
Stands corrected in the opening post above. |
Apmuthu, thank you. This thread was very helpful. Three additional things to mention:
Examples: |
Thanks Joseph. Stands corrected. |
Thank you WillRun4Cake... It's working great... https://www.hemantjadhav.com/ |
Duplicates #279 |
For those who have been manually implementing w/o Composer, the following two new includes are now required: |
@k00ni I agree. I've pinned the issue. Can you update the initial post? |
Thanks @k00ni and @j0k3r. Relative to the project directory, I think a current full list of includes would look something like this:
|
vendor-autoload.zip |
Sorry I missed this @k00ni and thanks @apmuthu for posting up a drop-in file. For what it's worth, I implement pdfparser as part of a larger class responsible for all PDF-related functionality. Here's how the pdfparser component get's wired up (trimmed up a bit for simplicity): <?php
$prerequisites = array();
$pdfparser = '/host/path/to/pdfparser';
$prerequisites['pdfparser'] = array (
$pdfparser.'/Parser.php',
$pdfparser.'/Document.php',
$pdfparser.'/Header.php',
$pdfparser.'/PDFObject.php',
$pdfparser.'/Element.php',
$pdfparser.'/Encoding.php',
$pdfparser.'/Font.php',
$pdfparser.'/Page.php',
$pdfparser.'/Pages.php',
$pdfparser.'/Element/ElementArray.php',
$pdfparser.'/Element/ElementBoolean.php',
$pdfparser.'/Element/ElementString.php',
$pdfparser.'/Element/ElementDate.php',
$pdfparser.'/Element/ElementHexa.php',
$pdfparser.'/Element/ElementMissing.php',
$pdfparser.'/Element/ElementName.php',
$pdfparser.'/Element/ElementNull.php',
$pdfparser.'/Element/ElementNumeric.php',
$pdfparser.'/Element/ElementStruct.php',
$pdfparser.'/Element/ElementXRef.php',
$pdfparser.'/Encoding/StandardEncoding.php',
$pdfparser.'/Encoding/ISOLatin1Encoding.php',
$pdfparser.'/Encoding/ISOLatin9Encoding.php',
$pdfparser.'/Encoding/MacRomanEncoding.php',
$pdfparser.'/Encoding/WinAnsiEncoding.php',
$pdfparser.'/Font/FontCIDFontType0.php',
$pdfparser.'/Font/FontCIDFontType2.php',
$pdfparser.'/Font/FontTrueType.php',
$pdfparser.'/Font/FontType0.php',
$pdfparser.'/Font/FontType1.php',
$pdfparser.'/RawData/FilterHelper.php',
$pdfparser.'/RawData/RawDataParser.php',
$pdfparser.'/XObject/Form.php',
$pdfparser.'/XObject/Image.php'
);
foreach($prerequisites as $project => $includes) {
foreach($includes as $mapping => $file) {
require_once $file;
}
}
?> |
I have updated my example for using PdfParser when Composer is not an option. It now aligns with the v0.17.1 release and includes 3 new files: You can download, extract and copy this to your webroot directory to start using PdfParser immediately. This should be placed in the /var/www/html directory or public_html webroot directory, as applicable. Two additional things to mention: PdfParser Team, I noticed that Object.php was renamed to PDFObject.php. Thanks for making this fix. |
I have attached an updated set of example files to use the new files:
/RawData/FilterHelper.php
/RawData/RawDataParser.php
This should now align with v0.17.1. This took quite some time to get around
to doing, but hopefully this will be helpful to someone. Thanks for
including me in the email list.
…On Mon, Aug 17, 2020 at 3:58 AM Konrad Abicht ***@***.***> wrote:
OK, i adapted @apmuthu <https://github.com/apmuthu>'s initial post with
code from @ndmax <https://github.com/ndmax>. Hope I didn't miss something.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#117 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALLVSTMQFQ26MWWS6MIKUOTSBDPLVANCNFSM4CQZJZ3Q>
.
|
Hello Everyone, If you're still implementing this project manually and you're suddenly getting 500s with
@apmuthu @k00ni it might be worth adding |
@ndmax thank you for the hint. I updated the initial post accordingly. In my opinion
Advantages:
What do you think? |
That might be a good idea. We should warm people that the |
I think it's a good approach @k00ni. It eliminates the cat-and-mouse for the few who incorporate manually, without disrupting the majority who install with Composer. Comment instructions at the top of |
The said A file called In order not to break dependencies of certain missing libraries / files, the optional set of includes can be commented out and enabled as needed by the end user. Notes in it as applicable to certain commits onwards would be useful to use the appropriate version. |
There is a new pull request which may help in the future. Once it passes there should be no more manual work required to use PDFParser without Composer. Feedback is appreciated at #388 |
Thanks a lot, it worked perfectly! Regards from Brazil. |
Alternative Autoloader built in
Since v0.18.2 you don't need to do the following steps to use PDFParser without Composer. Please check https://github.com/smalot/pdfparser#install for further information on our alternative autoloader.
❗ Outdated
Last checked in 2020
Updated file: vendor-autoload.zip - See #117 (comment)
The
../vendor/autoload.php
gets generated when we use composer and we include it in our scripts for PdfParser access. If we wish to freeze our install and manage it without using Composer, this said file can be created to have the following:We can now create a
test.php
in the deployment folder (pdfdemos
here) with:EDIT 1 by k00ni: added updated PHP code from @ndmax. Also removed
tecnickcom/tcpdf
(not needed anymore) and added code highlighting.The text was updated successfully, but these errors were encountered: