Laravel/PHP - Dompdf export PDF file with large size - laravel-dompdf

I have 10000+ rows in database that need to be export PDF file. I use dom-pdf to export but status:
"This page isn’t working
Localhost is currently unable to handle this request.
HTTP ERROR 500"
How to fix it? Thanks you!
My code:
ExportController:
...// get 10000+ data to db
$pdf = PDF::loadView('admin.export_pdf', $data)->setPaper('a4', 'landscape');
return $pdf->download('users.pdf');
I try to set memory_limit=512M in php.ini but not working.

Related

Read excel file in a directory using pyspark

`Hi ,
I am trying to read excel file in a directory using pyspark but i am getting fielnotfound error
`env_path='dbfs:/mnt'
raw='dev/raw/work1'
path=env_path+raw
file_path=path+'/'
objects = dbutils.fs.ls(file_path)
for file_name in objects:
`if file_name.isFile():
sample_df=spark.read.format("com.crealytics.spark.excel").option("header", "false").load(objects+file_name) `
I am trying this code to read my excel file but getting file not found error .can someone help me with this?`
I think in load you are not passing the proper path. So you are getting the error file not found error.
Try this you will get the output.
objects = dbutils.fs.ls(path)
for file_name in objects:
if file_name.isFile():
if file_name[0].endswith("xlsx"): #optional
sample_df=spark.read.format("com.crealytics.spark.excel").option("header", "true").load(file_name[0])

How to download a file (csv.gz) from a url using Python 3.7

As with others who have posted in the past, I cannot figure out to download a csv.gz file from a URL in Python 3.7. I see posts but they only post a 2kb file.
I am a 100% newbie using Python. What follows is the code for one file that I am trying to obtain. I can't even do that. The final goal would be to request all files that start with 2019* using python. Please try the code below to save the file. As others stated, the file is just a name without the true content - Ref: Downloading a csv.gz file from url in Python
import requests
url = 'https://public.bitmex.com/?prefix=data/trade/20191026.csv.gz'
r = requests.get(url, allow_redirects=True)
open('20191026.csv.gz', 'wb').write(r.content)
Yields:
Out[40]:
1245
I've tried "wget" and urllib.request along with "urlretrieve" also.
I wish I could add a screenshot or attach a file. The file created is 2kb and not even a csv.gz file. But the true file that I can download from a web browser is 78mb. The file is 20191026.csv.gz not that it matters as they all do the same thing. The location is https://public.bitmex.com/?prefix=data/trade/
Again, if you know of a way to obtain all the files using a filter such that 2019*csv.gz would be fantastic.
You are trying to download the files from https://public.bitmex.com/?prefix=data/trade/.
To achieve your final goal of download all the files starting from 2019* you have to do in 3 steps
1) you read the content of https://public.bitmex.com/?prefix=data/trade/
2) convert the content into an list, from that filter out the file names which starting from 2019.
3) from the result list try to download the csv using the example which you referring.
Hope this approach will help you
Happy coding.

magento 2 export not working , after clicking continue its redirect to the dashboard

Product CSV created in var folder but it's not getting the download. Or CSV file shows 302 error.
I tried all the solutions given for not working export. is there any other way?
1.expected result: It should download a CSV file
2.actual result: It only generates a file in the var folder but not getting a download.
You have to remove deprecated "modules_disable_output" values from core_config_data,
Before run below query please take backup of core_config_data table.
DELETE FROM core_config_data WHERE path LIKE
"advanced/modules_disable_output/%";
And clear cache
Hope it will work for you.

SpreadsheetGear - Save Specific Workbook Sheet to CSV

I am opening an existing Excel file using SpreadsheetGear, using the following code:
SpreadsheetGear.IWorkbook xlBook = SpreadsheetGear.Factory.GetWorkbook(fileName, System.Globalization.CultureInfo.CurrentCulture);
xlBook.SaveAs(fileNameCSV, SpreadsheetGear.FileFormat.CSV);
This works, but the saved CSV file contains the wrong sheet.
Can anyone help with a code snippet on how to open an Excel file in SpreadsheetGear, then save only a SPECIFIC sheet to a CSV file.
Please note I am working with SpreadsheetGear and want a solution for that library. Thanks!
The IWorksheet interface includes a SaveAs(...) method for just this purpose:
using SpreadsheetGear;
using System.Globalization;
...
IWorkbook xlBook = Factory.GetWorkbook(fileName, CultureInfo.CurrentCulture);
xlBook.Worksheets["My Sheet"].SaveAs(fileNameCSV, FileFormat.CSV);
I'll also mention that there is also an IRange.SaveAs(...) method if you want to save just a particular range to CSV / UnicodeText (tab-delimited).

CrystalReportSource binding

Hello I have a crystalReportViewer and CrystalReportSource on a web form.
I need to be able to bind the reportSource at run time to different report files.
I have the file data stored in a blob in a DB.
The mechanism I am using now is to save the blob to a file and then
this.CrystalReportSource1.Report.FileName = myFileName;
The issue is that I want to avoid saving the file on disk and somehow bind the report directly to a file stream.
Is that possible?
Thanks
In C#, I believe that you should be able to use something like the following, but I haven't tested it out on my system.
ReportDocument rpt = new ReportDocument();
rpt.Load(filestream); //filestream is your filestream object
Give it a try and let me know if you have issues.