Change DocumentName using Ghostscript - c#

I have requirement of changing DocumentName that is being printed. This document name will display in printer spool. I am using Ghostscript c# wrapper to print PDF. It shows "Ghostscript output" in printer spool list. Ghostscript documentation provides a way but I didn't manage to make it work.
Here in 10.2 section they described it.
https://www.ghostscript.com/doc/9.26/Devices.htm#Win
This is what I tried to run with CLI :
gswin64c.exe "D:\setup.ps" -o "D:/test.pdf" "C:\Users\ashish\Documents\tt.pdf"
Setup.ps
mark
/NoCancel true % don't show the cancel dialog
/BitsPerPixel 4 % force 4 bits/pixel
/UserSettings
<<
/DocumentName (Ghostscript document) % name for the Windows spooler
/MaxResolution 360 % maximum document resolution
>>
(mswinpr2) finddevice % select the Windows device driver
putdeviceprops
setdevice
Result:
GPL Ghostscript 9.52 (2020-03-19)
Copyright (C) 2020 Artifex Software, Inc. All rights reserved.
This software is supplied under the GNU AGPLv3 and comes with NO WARRANTY:
see the file COPYING for details.
| c:\Users\cjl\artifex\gs-release\9.52\ghostpdl-9.52\base\gsicc_manage.c:1888: gsicc_verify_device_profiles(): Mismatch of ICC profiles and device color model
| c:\Users\cjl\artifex\gs-release\9.52\ghostpdl-9.52\base\gsicc_manage.c:2015: gsicc_set_device_profile(): Error in device profiles
Error: /undefined in --.systemvar--
Operand stack:
rangecheck --dict:736/1123(ro)(G)-- .putdeviceprops
Execution stack:
%interp_exit .runexec2 --nostringval-- .systemvar --nostringval-- 2 %stopped_push --nostringval-- .systemvar .systemvar false 1 %stopped_push 1990 1 3 %oparray_pop 1989 1 3 %oparray_pop 1977 1 3 %oparray_pop 1833 1 3 %oparray_pop --nostringval-- %errorexec_pop .runexec2 --nostringval-- .systemvar --nostringval-- 2 %stopped_push --nostringval-- 1831 8 3 %oparray_pop .systemvar 1814 8 3 %oparray_pop .systemvar 1808 2 3 %oparray_pop
Dictionary stack:
--dict:736/1123(ro)(G)-- --dict:0/20(G)-- --dict:75/200(L)--
Current allocation mode is local
Last OS error: Permission denied
Current file position is 430
GPL Ghostscript 9.52: Unrecoverable error, exit code 1
Thanks

Related

BSOD 0x8E STATUS_SINGLE_STEP

I have a BSOD 0x8E every day on five devices in same times on Windows 7.
Allways exception code - 04 - STATUS_SINGLE_STEP
as example:
1: kd> !analyze -v
*******************************************************************************
* *
* Bugcheck Analysis *
* *
*******************************************************************************
KERNEL_MODE_EXCEPTION_NOT_HANDLED_M (1000008e)
This is a very common bugcheck. Usually the exception address pinpoints
the driver/function that caused the problem. Always note this address
as well as the link date of the driver/image that contains this address.
Some common problems are exception code 0x80000003. This means a hard
coded breakpoint or assertion was hit, but this system was booted
/NODEBUG. This is not supposed to happen as developers should never have
hardcoded breakpoints in retail code, but ...
If this happens, make sure a debugger gets connected, and the
system is booted /DEBUG. This will let us see why this breakpoint is
happening.
Arguments:
Arg1: 80000004, The exception code that was not handled
Arg2: ffdff2a5, The address that the exception occurred at
Arg3: a9c34d48, Trap Frame
Arg4: 00000000
Debugging Details:
------------------
DUMP_CLASS: 1
DUMP_QUALIFIER: 400
BUILD_VERSION_STRING: 7601.17514.x86fre.win7sp1_rtm.101119-1850
SYSTEM_MANUFACTURER: System manufacturer
SYSTEM_PRODUCT_NAME: System Product Name
SYSTEM_SKU: SKU
SYSTEM_VERSION: System Version
BIOS_VENDOR: American Megatrends Inc.
BIOS_VERSION: 1002
BIOS_DATE: 06/04/2013
BASEBOARD_MANUFACTURER: ASUSTeK COMPUTER INC.
BASEBOARD_PRODUCT: P8H61-I LX R2.0
BASEBOARD_VERSION: Rev X.0x
DUMP_TYPE: 2
BUGCHECK_P1: ffffffff80000004
BUGCHECK_P2: ffffffffffdff2a5
BUGCHECK_P3: ffffffffa9c34d48
BUGCHECK_P4: 0
EXCEPTION_CODE: (HRESULT) 0x80000004 (2147483652) - <Unable to get error code text>
FAULTING_IP:
+0
ffdff2a5 0000 add byte ptr [eax],al
TRAP_FRAME: a9c34d48 -- (.trap 0xffffffffa9c34d48)
ErrCode = 00000000
eax=00000000 ebx=846410c0 ecx=00000000 edx=00000000 esi=0c4cdb04 edi=00000000
eip=ffdff2a5 esp=a9c34dbc ebp=801ef000 iopl=0 ov dn di ng nz na pe nc
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00004c86
ffdff2a5 0000 add byte ptr [eax],al ds:0023:00000000=??
Resetting default scope
CPU_COUNT: 2
CPU_MHZ: a8c
CPU_VENDOR: GenuineIntel
CPU_FAMILY: 6
CPU_MODEL: 3a
CPU_STEPPING: 9
CPU_MICROCODE: 6,3a,9,0 (F,M,S,R) SIG: 17'00000000 (cache) 17'00000000 (init)
CUSTOMER_CRASH_COUNT: 1
DEFAULT_BUCKET_ID: BAD_STACK_0x8E
BUGCHECK_STR: 0x8E
PROCESS_NAME: avp.exe
CURRENT_IRQL: 0
ANALYSIS_SESSION_HOST: NETMANNOTE
ANALYSIS_SESSION_TIME: 11-17-2017 12:11:18.0584
ANALYSIS_VERSION: 10.0.15063.468 x86fre
LAST_CONTROL_TRANSFER: from 00000000 to ffdff2a5
STACK_TEXT:
a9c34db8 00000000 0000027f 00000000 00000000 0xffdff2a5
STACK_COMMAND: .trap 0xffffffffa9c34d48 ; kb
SYMBOL_NAME: ANALYSIS_INCONCLUSIVE
FOLLOWUP_NAME: MachineOwner
MODULE_NAME: Unknown_Module
IMAGE_NAME: Unknown_Image
DEBUG_FLR_IMAGE_TIMESTAMP: 0
BUCKET_ID: BAD_STACK_0x8E
PRIMARY_PROBLEM_CLASS: BAD_STACK
FAILURE_BUCKET_ID: BAD_STACK_0x8E
TARGET_TIME: 2017-11-16T13:53:07.000Z
OSBUILD: 7601
OSSERVICEPACK: 1000
SERVICEPACK_NUMBER: 0
OS_REVISION: 0
SUITE_MASK: 336
PRODUCT_TYPE: 1
OSPLATFORM_TYPE: x86
OSNAME: Windows 7
OSEDITION: Windows 7 WinNt (Service Pack 1) TerminalServer EmbeddedNT SingleUserTS
OS_LOCALE:
USER_LCID: 0
OSBUILD_TIMESTAMP: 2010-11-20 11:42:49
BUILDDATESTAMP_STR: 101119-1850
BUILDLAB_STR: win7sp1_rtm
BUILDOSVER_STR: 6.1.7601.17514.x86fre.win7sp1_rtm.101119-1850
ANALYSIS_SESSION_ELAPSED_TIME: cc3
ANALYSIS_SOURCE: KM
FAILURE_ID_HASH_STRING: km:bad_stack_0x8e
FAILURE_ID_HASH: {993602b9-6aa7-fbab-86a8-bb6ad81a3997}
Followup: MachineOwner
The service name can be different: av.exe, scvhost.ext,..
I know that is due to the a driver does not process STATUS_SINGLE_STEP exception.
Is any idea how to find wrong driver? There is no stack and module name in the dump...
I tried to run the Mirosoft Driver Verifier with standart flags and all drivers without Microsoft drivers, dump listing is above.

How can we get Disk Performance info in C#

I want to get the following information about the disk performance.
I used MSStorageDriver_FailurePredictThresholds, MSStorageDriver_ATAPISmartData, MSStorageDriver_FailurePredictStatus class to get relative information but not getting the right result.
This isn't everything you wanted, but the Win32_PerfFormattedData_PerfDisk_PhysicalDisk WMI class gives you current read / write / transfer rate and activity time. It also gives some averages but I'm not sure how they are calculated (it seems odd that AvgDiskBytesPerWrite is 0)
// NOTE: Use ManagementObjectSearcher to find the path your interested in
var path = "Win32_PerfFormattedData_PerfDisk_PhysicalDisk.Name='0 C:'";
var wmiObj = new ManagementObject(path);
wmiObj.Properties.Cast<PropertyData>().ToDictionary(p => p.Name, p => p.Value).Dump();
/* OUTPUT */
AvgDiskBytesPerRead 63167
AvgDiskBytesPerTransfer 63167
AvgDiskBytesPerWrite 0
AvgDiskQueueLength 0
AvgDiskReadQueueLength 0
AvgDisksecPerRead 0
AvgDisksecPerTransfer 0
AvgDisksecPerWrite 0
AvgDiskWriteQueueLength 0
Caption null
CurrentDiskQueueLength 0
Description null
DiskBytesPersec 20991616
DiskReadBytesPersec 20991616
DiskReadsPersec 332
DiskTransfersPersec 332
DiskWriteBytesPersec 0
DiskWritesPersec 0
Frequency_Object null
Frequency_PerfTime null
Frequency_Sys100NS null
Name 0 C:
PercentDiskReadTime 80
PercentDiskTime 80
PercentDiskWriteTime 0
PercentIdleTime 32
SplitIOPerSec 0
Timestamp_Object null
Timestamp_PerfTime null
Timestamp_Sys100NS null
if you looking for this, check this Link. An example of output is:
###############################################################
Current Directory Path: D:\WinDDK\32bit\drivespeed
Total MB 230000, Free MB 103752, Used MB 126248
Windows Storage Speed Test 32-Bit Version 1.2, Thu Mar 01 22:31:08 2012
Copyright (C) Roy Longbottom 2011
8 MB File 1 2 3 4 5
Writing MB/sec 56.68 105.37 61.95 72.48 75.33
Reading MB/sec 80.65 108.15 81.10 81.42 82.25
16 MB File 1 2 3 4 5
Writing MB/sec 81.53 94.61 81.41 88.06 71.39
Reading MB/sec 88.25 72.75 93.53 93.51 92.70
32 MB File 1 2 3 4 5
Writing MB/sec 90.35 83.60 72.52 80.24 72.71
Reading MB/sec 87.00 87.67 78.39 80.24 78.62
---------------------------------------------------------------------
8 MB Cached File 1 2 3 4 5
Writing MB/sec 703.27 628.08 1050.99 1617.29 1609.70
Reading MB/sec 1930.60 2045.13 2054.49 2135.91 2390.08
---------------------------------------------------------------------
Bus Speed Block KB 64 128 256 512 1024
Reading MB/sec 174.36 189.07 221.83 247.82 261.21
---------------------------------------------------------------------
1 KB Blocks File MB > 2 4 8 16 32 64 128
Random Read msecs 0.14 0.14 0.15 0.17 3.24 6.96 8.90
Random Write msecs 0.53 0.66 1.03 1.38 1.74 1.83 2.42
---------------------------------------------------------------------
500 Files Write Read Delete
File KB MB/sec ms/File MB/sec ms/File Seconds
2 0.32 6.44 0.95 2.17 0.123
4 6.49 0.63 12.21 0.34 0.113
8 11.54 0.71 15.17 0.54 0.121
16 22.04 0.74 41.78 0.39 0.116
32 32.92 1.00 26.31 1.25 0.074
64 68.72 0.95 51.88 1.26 0.132
End of test Thu Mar 01 22:32:11 2012

FFMPEG - Scrambled Output converting from VOB with ffmpeg

I've concatenated a series of VOB files from a DVD into a single VOB file and I am trying to convert it to MP4 or other similar format. I see a lot of errors when converting and the output appears scrambled.
>ffmpeg.exe" -i file.vob -sameq file.mp4
FFmpeg version git-N-29181-ga304071, Copyright (c) 2000-2011 the FFmpeg develope
rs
built on Apr 18 2011 21:24:03 with gcc 4.5.2
configuration: --enable-gpl --enable-version3 --enable-runtime-cpudetect --ena
ble-memalign-hack --enable-avisynth --enable-bzlib --enable-frei0r --enable-libo
pencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --
enable-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger
--enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enabl
e-libx264 --enable-libxavs --enable-libxvid --enable-zlib --cross-prefix=i686-w6
4-mingw32- --target-os=mingw32 --arch=x86_32 --extra-cflags=-I/home/kyle/softwar
e/ffmpeg/external-libraries/win32/include --extra-ldflags=-L/home/kyle/software/
ffmpeg/external-libraries/win32/lib --pkg-config=pkg-config
libavutil 50. 40. 1 / 50. 40. 1
libavcodec 52.120. 0 / 52.120. 0
libavformat 52.108. 0 / 52.108. 0
libavdevice 52. 4. 0 / 52. 4. 0
libavfilter 1. 79. 0 / 1. 79. 0
libswscale 0. 13. 0 / 0. 13. 0
[mpeg2video # 01751A90] ac-tex damaged at 5 16
[mpeg2video # 01751A90] invalid mb type in I Frame at 0 1
[mpeg2video # 01751A90] invalid mb type in I Frame at 0 2
[mpeg2video # 01751A90] invalid mb type in I Frame at 0 3
[mpeg2video # 01751A90] invalid mb type in I Frame at 0 4
[...]
I'm guessing this is CSS scrambling and I need to do some sort of DeCSS. Does FFMpeg have an option for this? Cringe if you'd like, but is there C# source to achieve this?
My end goal is really just to get some DVDs that I own onto my media server. I've tried a few demo-ware products with limited success including Acala DVD Ripper, Click to Disk, AVIDemux to name a few. I even paid for a couple of them to get the full version, but Acala only works for about half of my DVDs and Click to Disk can decode the VOB, but I need to use FFMpeg to convert. I'd like to have it all in one app that works and I am willing to write some code for it.

snmp oid for scanner detail(HP LaserJet 3055)

How can i access scanner details (eg. HP LaserJet 3055 ) in windows service (.net framework 4.0).by using mib tree ?
Anyone please tell me the OID for getting detail such as scanner_ADF_PageCount,TotalPagesJammed,etc for scanner.
I compare each oid with "1.3.6.1.4.1.11.2.3.9.4.2.1.2.2". But still it is not giving above detail.
1) scanner-accessory-adf-sheet-count - .1.3.6.1.4.1.11.2.3.9.4.2.1.2.2.1.20.0
2) hrprinterdetectederrorstate - .1.3.6.1.2.1.25.3.5.1.2 . It returns an octet string and you need to interpret it as
Condition Bit # hrDeviceStatus
lowPaper 0 warning(3)
noPaper 1 down(5)
lowToner 2 warning(3)
noToner 3 down(5)
doorOpen 4 down(5)
jammed 5 down(5)
offline 6 down(5)
serviceRequested 7 warning(3)
I got this information from HP-LASERJET-COMMON-MIB and you can download it from here. Browse through it for more details.

Better MonoTouch crashes with TestFlight

We've hooked up TestFlight and the TestFlight SDK with MonoTouch and so far it's working great.
One thing we've noticed is that the crash reports are more geared towards Obj-C apps.
They look like this after you upload a zipped dSYM file:
0 OurApp 0x007a7116 testflight_backtrace + 170
1 OurApp0x007a7c3c TFSignalHandler + 208
2 libsystem_c.dylib 0x34f68538 _sigtramp + 48
3 libsystem_c.dylib 0x34f5df5a pthread_kill + 54
4 libsystem_c.dylib 0x34f56fea abort + 94
5 OurApp 0x007793b3 monoeg_g_logv (goutput.c:137)
6 OurApp 0x0077941f monoeg_g_log (goutput.c:147)
7 OurApp 0x005f1393 get_numerous_trampoline (aot-runtime.c:3447)
8 OurApp 0x005f1b2f mono_aot_get_imt_thunk (aot-runtime.c:3576)
9 OurApp 0x006e2c83 initialize_imt_slot (object.c:1247)
10 OurApp 0x006e321f build_imt_slots (object.c:1371)
11 OurApp 0x006e356f mono_vtable_build_imt_slot (object.c:1439)
12 OurApp 0x005fcf83 mono_convert_imt_slot_to_vtable_slot (mini-trampolines.c:198)
13 OurApp 0x005fd50f common_call_trampoline (mini-trampolines.c:333)
14 OurApp 0x005fe573 mono_vcall_trampoline (mini-trampolines.c:644)
15 OurApp 0x0056a68f generic_trampoline_vcall (mscorlib.dll.6.s:194345)
16 OurApp 0x00416b4f System_Collections_Generic_List_1__ctor_System_Collections_Generic_IEnumerable_1_T (mscorlib.dll.6.s:32014)
17 OurApp 0x0026955b System_Linq_Enumerable_ToList_TSource_System_Collections_Generic_IEnumerable_1_TSource (System.Core.dll.6.s:1917)
So you can tell the general C# function where the crash occurred. (Note: this crash was a bug in MonoTouch 5.0.1 where Linq generics were messed up, seems to be fixed in 5.0.2)
It would be nice to get the full C# stack trace in here, any thoughts on how to do that? I could hook into AppDomain.UnhandledException and put a try-catch around my static void Main method, but wondered if there is a way to report the stack trace out to TestFlight.
I'm not familiar with MonoTouch, but what about using the Remote Logging features of the TestFlight SDK?

Categories

Resources