Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: PDF books library help  (Read 5753 times)

0 Members and 1 Guest are viewing this topic.

core1985

    Topic Starter


    Beginner
  • I am lecturer in physics
  • Experience: Experienced
  • OS: Windows 7
PDF books library help
« on: July 06, 2020, 11:27:19 AM »
Dear Users

I have lot of pdf books. How can I make a library in my system like add pdf books some kind of home page appears and when I click any book it opens

Sidewinder



    Guru

    Thanked: 139
  • Experience: Familiar
  • OS: Windows 10
Re: PDF books library help
« Reply #1 on: July 07, 2020, 04:53:44 AM »
I took a more low level approach and used batch as the coding language. Ugly but serviceable. Python, Rexx (Classic or Object), Javascript, VBScript, and others could also be used with the same approach. Powershell (Windows or Core but not v6.x) or even a HTA (using Vbscript or JScript or both) could be used if you wanted a GUI.

Code: [Select]
@echo off
:: -------------------------------------------------------------
::  Script:   Library
::  Author:   Sidewinder
::  Date:     07/06/2020
::  Comment:  PDF Catalog Selector
::  Update:   
:: -------------------------------------------------------------
setlocal enabledelayedexpansion
pushd g:\COM\Documents
set x=0

for /f "delims=" %%i in ('dir /b *.pdf') do (
  call set /a x+=1
  call set item.%%x%%=%%~dpnxi
  call echo !x!. %%~ni
)

echo.
set /p sel=Enter Selection:
if %sel% EQU 0 goto terminate
if %sel% GTR !x! goto error
if %sel% LSS 0 goto error

!item.%sel%!
goto terminate

:error
  echo Selection Out Of Range
 
:terminate
  popd

Change the name of the folder on line 10 and you should be good to go. Script uses a single folder for the pdf files, but if they live in multiple folders, the code can be tweaked to handle it.

Good luck. Hope this gives you some ideas  8)
The true sign of intelligence is not knowledge but imagination.

-- Albert Einstein

core1985

    Topic Starter


    Beginner
  • I am lecturer in physics
  • Experience: Experienced
  • OS: Windows 7
Re: PDF books library help
« Reply #2 on: July 07, 2020, 10:09:43 AM »
Will it show the pdf books like catalog?? with book cover page images and which language is best to support it

Sidewinder



    Guru

    Thanked: 139
  • Experience: Familiar
  • OS: Windows 10
Re: PDF books library help
« Reply #3 on: July 07, 2020, 12:06:21 PM »
Hi,

Code: [Select]
Will it show the pdf books like catalog?? with book cover page images

Did you run the script? All it does is print an on-screen menu of the pdf files it found. Each book is numbered so all the user needs to do is select one. There are no thumbnails. When a selection is made the book is opened the same as if the user used Windows Explorer and double clicked the file.

Code: [Select]
which language is best to support it

Not sure what this means. The script is written in batch language. Save the script on your disk with any name and a .bat or .cmd extension. Open a command prompt, navigate to the folder where the file is saved and run it.

A few notes: If user selects 0 then no selection is made and the script ends quietly. If the selection made is greater than the number of books or less than zero, an error is thrown and then script ends quietly.

The pdf file is opened with the program associated with the pdf extension. If there is no association, you may have to add a path and program name to: !item.%sel%!

Happy Motoring 8)
The true sign of intelligence is not knowledge but imagination.

-- Albert Einstein