Concatenate Array of PDF Files Using File Paths not working - arrays

I was following the Guide on "How to concatenate array of pdf using file path" on this page But with no luck.
example: Using the code
using Aspose.Pdf.Facades;
string[] filesArray = new string[2];
filesArray[0] = #"D:\MergedPDF\Ball_007811263X\baL1263x_ch01_001-029.pdf";
filesArray[1] = #"D:\MergedPDF\Ball_007811263X\baL1263x_ch02_030-061.pdf";
// create PdfFileEditor object
PdfFileEditor pdfEditor = new PdfFileEditor();
// display the resultant concatenated PDF file in
pdfEditor.Concatenate(filesArray, "outputfoe.pdf");
but it give me an error on the pdfEditor part of pdfEditor.Concatenate(filesArray, "outputfoe.pdf");
The error says:
Error 1 The type 'System.Web.HttpResponse' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. C:\Users\rsubedi\Documents\Visual Studio 2012\Projects\MergePDFManual\MergePDFManual\Program.cs 26 13 MergePDFManual

It's trying to open the web browser to display the new PDF. Try adding the assembly System.Web and see what happens

Related

IronPDF html query parameter

Does IronPDF support html query parameters, or is there an alternate method?
I've been using IronPDF to convert an html file to PDF using the following method: var pdf = ironRenderer.RenderUrlAsPdf(reportPath);
However, the html located at reportPath now requires a parameter userid. I have tried var pdf = ironRenderer.RenderUrlAsPdf(reportPath?userid=1); but that gives me the following error: CheckHtmlFilePath - File not found: .../index.html%3Fuserid=1'
I can't see any documentation in IronPdf that parameters are supported. Does anyone have any work arounds?
Instead of adding the parameter to the variable name, add it to the string. For example:
reportPath += "?userid=1";
var pdf = ironRenderer.RenderUrlAsPdf(reportPath);
Check the URL to see if there is already a parameter, and manipulate the URL string accordingly. If you posted more code I could have described more.

Array of large amount of integers in xml string file Kotlin android Studio

I want to make a Spinner to select the age ofthe users of my app. I wanted to know how I could create an array of all integers between 0 and 10 in the string resource file .xml in android Studio.
This is what I thought I was going to do
<integer-array name="AgeArray">
<item>1</item>
<item>2</item>
<item>3</item>
<item>4</item>
<item>5</item>
<item>6</item>
<item>7</item>
<item>8</item>
<item>9</item>
<item>10</item>
<item>12</item>
<item>13</item>
<item>14</item>
<item>15</item>
<item>16</item>
<item>17</item>
<item>18</item>
<item>19</item>
<item>20</item>
</integer-array>
But I thought that there must be a more elegant, more efficient way of creating such an array, or am I wrong?
Thanks in advance
You cannot write to a resource file (at runtime), resource files are read-only.
While developing you can create a scratch file in Android Studio, execute the following code and then copy-paste the result from the output panel to the resource file:
val list = (1..100).joinToString("\n") { " <item>$it</item>" }
val xml = "<integer-array name=\"AgeArray\">\n$list\n</integer-array>\n"
println(xml)

Unable to open a file with uigetfile in Matlab

I am building a code that lets the user open some files.
reference = warndlg('Choose the files for analysis.');
uiwait(reference);
filenames2 = uigetfile('./*.txt','MultiSelect', 'on');
if ~iscell(filenames2)
filenames2 = {filenames2}; % force it to be a cell array of strings
end
numberOfFiles = numel(filenames2);
data = importdata(filenames2{i},delimiterIn,headerlinesIn);
When I run the code, the prompts show up, I press OK, and then nothing happens. The code just stops, telling me :
Error using importdata (line 137)
Unable to open file.
Error in FreqVSChampB_no_spec (line 119)
data=importdata(filenames2{1},delimiterIn,headerlinesIn);
I just don't have the opportunity to select a file. The cellarray stays empty as showed in the following image.
MATLAB can't find the file that you have selected. Your variable filenames2 contains only the name of the file, not its full path. If you don't provide the full path to importdata, it will search for whatever file name you provide on the MATLAB path, and if it can't find it it will error as you see.
Try something like this - I'm just doing it with single selection for ease of description, but you can do something similar with multiple selection.
[fileName, pathName] = uigetfile('*.txt');
fullNameWithPath = fullfile(pathName, fileName);
importdata(fullNameWithPath)
fullfile is useful, as it inserts the correct character between pathName and fileName (\ on Windows, / on Unix).
You can try to add
pause(0.1);
just after uiwait(reference);
For me it works. In fact I've noticed the active windows changes when we use uiwait and uigetfile.

Loading ResourceDictionary resource at runtime from assemblies with the same name

I encountered some problem when trying to load resources from two separate assemblies having the same name but located in a different folder:
C:\folder1\fcl.dll
C:\folder2\fcl.dll
A ResourceDictionary named Resources.xaml is embedded (as a Page) in each of these assemblies.
To load the first ResourceDictionary, I use the following snippet :
// Load the assembly in memory
var assembly = Assembly.LoadFrom(#"c:\folder1\FCL.Dll");
// Get Dictionnary
var uri = string.Format("pack://application:,,,/{0};Component/Resources.xaml", assembly.GetName().Name);
var resourceDictionary = new ResourceDictionary { Source = new Uri(uri) };
This is running !
But when I try to load the second ResourceDictionary with the same snippet of code (just changing Assembly.LoadFrom(#"c:\folder1\FCL.Dll") by Assembly.LoadFrom(#"c:\folder2\FCL.Dll"), it does not load resources from c:\folder2\fcl.dll, but those stored in the previously loaded c:\folder1\fcl.dll :-(
The cause: The shortAssemblyName field of the URI is the same, in may case FCL:
var uri = string.Format("pack://application:,,,/{0};Component/Resources.xaml", assembly.GetName().Name)
Does someone know how to solve this problem?
You can't have two assemblies loaded with the same name, so I think the second Assembly.LoadFrom is just being ignored. You are probably going to have to rename one of the assemblies.

Copy text from WPF DataGrid to Clipboard to Excel

I have WPF DataGrid (VS2010 C#). I copied the data from DataGrid to Clipboard and write it to an Excel file. Below is my code.
dataGrid1.SelectAllCells();
dataGrid1.ClipboardCopyMode = DataGridClipboardCopyMode.IncludeHeader;
ApplicationCommands.Copy.Execute(null, dataGrid1);
dataGrid1.UnselectAllCells();
string path1 = "C:\\test.xls";
string result1 = (string)Clipboard.GetData(DataFormats.CommaSeparatedValue);
Clipboard.Clear();
System.IO.StreamWriter file1 = new System.IO.StreamWriter(path1);
file1.WriteLine(result1);
file1.Close();
Everything works out OK except when I open the excel file it gives me two warning:
"The file you are trying to open
'test.xls' is in a different format
than specified by the file extension.
Verify that the file is not corrupted
and is from a trusted source before
opening the file. Do you want to open
the file now?"
"Excel has detected that 'test.xls' is
a SYLK file, but cannot load it."
But after I click through it, it still open the excel file OK and data are formated as it supposed to be. But I can't find how to get rid of the two warnings before the excel file is open.
You need to use csv as extension. Xls is the Excel file extension.
So
string path1 = "C:\\test.csv";
should work.
A problem like yours has already been described here : generating/opening CSV from console - file is in wrong format error.
Does it helps to solve yours ?
Edit : Here is the Microsoft KB related => http://support.microsoft.com/kb/323626

Resources